From 05e2528311751472bfda1e62fb84ad8e41494612 Mon Sep 17 00:00:00 2001 From: prescientmoon Date: Sat, 12 Oct 2024 16:26:56 +0200 Subject: [PATCH] Clean up flake --- .github/workflows/build.yaml | 2 +- .prettierrc.json | 10 +++---- flake.lock | 17 +++++++----- flake.nix | 54 ++++++++---------------------------- src/main.tsx | 50 ++++++++++++++++----------------- 5 files changed, 53 insertions(+), 80 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index db3da62..9e3af0a 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -19,7 +19,7 @@ jobs: - uses: DeterminateSystems/magic-nix-cache-action@main - name: Build project - run: nix build .#erratic-gate-github-pages + run: nix build .#erratic-gate - name: Upload artifact uses: actions/upload-pages-artifact@v2 diff --git a/.prettierrc.json b/.prettierrc.json index 184f937..f2c8a73 100644 --- a/.prettierrc.json +++ b/.prettierrc.json @@ -1,7 +1,7 @@ { - "semi": false, - "trailingComma": "none", - "singleQuote": true, - "printWidth": 80, - "tabWidth": 2 + "semi": false, + "trailingComma": "none", + "singleQuote": true, + "printWidth": 80, + "tabWidth": 2 } diff --git a/flake.lock b/flake.lock index 6d6efac..1e5f4b8 100644 --- a/flake.lock +++ b/flake.lock @@ -20,15 +20,18 @@ }, "nixpkgs": { "locked": { - "lastModified": 1695360818, - "narHash": "sha256-JlkN3R/SSoMTa+CasbxS1gq+GpGxXQlNZRUh9+LIy/0=", - "path": "/nix/store/09yvj6yyxspzfivv91bcxwrjxawpk1g2-source", - "rev": "e35dcc04a3853da485a396bdd332217d0ac9054f", - "type": "path" + "lastModified": 1728538411, + "narHash": "sha256-f0SBJz1eZ2yOuKUr5CA9BHULGXVSn6miBuUWdTyhUhU=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "b69de56fac8c2b6f8fd27f2eca01dcda8e0a4221", + "type": "github" }, "original": { - "id": "nixpkgs", - "type": "indirect" + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" } }, "root": { diff --git a/flake.nix b/flake.nix index a2336f8..696790d 100644 --- a/flake.nix +++ b/flake.nix @@ -1,21 +1,22 @@ { - description = "Logic gate simulator"; - inputs.flake-utils.url = "github:numtide/flake-utils"; + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; - outputs = { nixpkgs, flake-utils, ... }: - flake-utils.lib.eachDefaultSystem (system: - let pkgs = nixpkgs.legacyPackages.${system}; + outputs = + { nixpkgs, flake-utils, ... }: + flake-utils.lib.eachDefaultSystem ( + system: + let + pkgs = nixpkgs.legacyPackages.${system}; in rec { - packages.erratic-gate = pkgs.buildNpmPackage { + packages.erratic-gate = pkgs.buildNpmPackage.override { stdenv = pkgs.stdenvNoCC; } { name = "erratic-gate"; - - buildInputs = [ pkgs.nodejs_18 ]; - src = pkgs.lib.cleanSource ./.; - npmDepsHash = "sha256-f5mw6IjkhZgsIuzCz9d7DvoAdceY1y+yWXn1BOonsVI="; - ESBUILD_BASEURL = ""; + npmDepsHash = "sha256-f5mw6IjkhZgsIuzCz9d7DvoAdceY1y+yWXn1BOonsVI="; installPhase = '' mkdir $out @@ -23,38 +24,7 @@ ''; }; - packages.erratic-gate-github-pages = packages.erratic-gate; packages.default = packages.erratic-gate; - - devShells.default = - pkgs.mkShell { - buildInputs = with pkgs; - with nodePackages_latest; [ - nodejs - ]; - }; - - apps.compute-npm-dep-hash = { - type = "app"; - program = pkgs.lib.getExe (pkgs.writeShellApplication { - name = "generate-layout-previes"; - runtimeInputs = [ pkgs.prefetch-npm-deps ]; - text = "prefetch-npm-deps ./package-lock.json"; - }); - }; } ); - - # {{{ Caching and whatnot - nixConfig = { - # extra-substituters = [ - # "erratic-gate.cachix.org-1:Ijiu/v//aVpKO4xBqV+2AM2s2uQYOnGCfoj9fYRXxtk" # I think I need this for neovim-nightly? - # ]; - # - # extra-trusted-public-keys = [ - # "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" - # ]; - }; - # }}} } - diff --git a/src/main.tsx b/src/main.tsx index 0088140..686c5b0 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -15,38 +15,38 @@ import { initAutoSave } from './modules/simulation-actions/helpers/initAutoSave' * The function wich does the heavy lifting for starting the app */ export const start = async () => { - // This will resolve at the first render - const result = loadSubject - .pipe( - filter((a) => a), - take(1) - ) - .toPromise() + // This will resolve at the first render + const result = loadSubject + .pipe( + filter((a) => a), + take(1) + ) + .toPromise() - // Handle possible errors - handleErrors() + // Handle possible errors + handleErrors() - // Create main renderer for the app - initRenderer() + // Create main renderer for the app + initRenderer() - // Register key bindings - initKeyBindings() + // Register key bindings + initKeyBindings() - // Update base templates - initBaseTemplates() + // Update base templates + initBaseTemplates() - // Easter egg - logWelcome() + // Easter egg + logWelcome() - // Update the logic gates in local storage - updateLogicGateList() + // Update the logic gates in local storage + updateLogicGateList() - // start the autosaving stuff - initAutoSave() + // start the autosaving stuff + initAutoSave() - // Render app component - render(, document.getElementById('app')) + // Render app component + render(, document.getElementById('app')) - // wait for the first render - await result + // wait for the first render + await result }