Clean up flake

This commit is contained in:
prescientmoon 2024-10-12 16:26:56 +02:00
parent 99bc2e3e33
commit 05e2528311
Signed by: prescientmoon
SSH key fingerprint: SHA256:WFp/cO76nbarETAoQcQXuV+0h7XJsEsOCI0UsyPIy6U
5 changed files with 53 additions and 80 deletions

View file

@ -19,7 +19,7 @@ jobs:
- uses: DeterminateSystems/magic-nix-cache-action@main - uses: DeterminateSystems/magic-nix-cache-action@main
- name: Build project - name: Build project
run: nix build .#erratic-gate-github-pages run: nix build .#erratic-gate
- name: Upload artifact - name: Upload artifact
uses: actions/upload-pages-artifact@v2 uses: actions/upload-pages-artifact@v2

View file

@ -1,7 +1,7 @@
{ {
"semi": false, "semi": false,
"trailingComma": "none", "trailingComma": "none",
"singleQuote": true, "singleQuote": true,
"printWidth": 80, "printWidth": 80,
"tabWidth": 2 "tabWidth": 2
} }

View file

@ -20,15 +20,18 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1695360818, "lastModified": 1728538411,
"narHash": "sha256-JlkN3R/SSoMTa+CasbxS1gq+GpGxXQlNZRUh9+LIy/0=", "narHash": "sha256-f0SBJz1eZ2yOuKUr5CA9BHULGXVSn6miBuUWdTyhUhU=",
"path": "/nix/store/09yvj6yyxspzfivv91bcxwrjxawpk1g2-source", "owner": "NixOS",
"rev": "e35dcc04a3853da485a396bdd332217d0ac9054f", "repo": "nixpkgs",
"type": "path" "rev": "b69de56fac8c2b6f8fd27f2eca01dcda8e0a4221",
"type": "github"
}, },
"original": { "original": {
"id": "nixpkgs", "owner": "NixOS",
"type": "indirect" "ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
} }
}, },
"root": { "root": {

View file

@ -1,21 +1,22 @@
{ {
description = "Logic gate simulator"; inputs = {
inputs.flake-utils.url = "github:numtide/flake-utils"; nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { nixpkgs, flake-utils, ... }: outputs =
flake-utils.lib.eachDefaultSystem (system: { nixpkgs, flake-utils, ... }:
let pkgs = nixpkgs.legacyPackages.${system}; flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
in in
rec { rec {
packages.erratic-gate = pkgs.buildNpmPackage { packages.erratic-gate = pkgs.buildNpmPackage.override { stdenv = pkgs.stdenvNoCC; } {
name = "erratic-gate"; name = "erratic-gate";
buildInputs = [ pkgs.nodejs_18 ];
src = pkgs.lib.cleanSource ./.; src = pkgs.lib.cleanSource ./.;
npmDepsHash = "sha256-f5mw6IjkhZgsIuzCz9d7DvoAdceY1y+yWXn1BOonsVI=";
ESBUILD_BASEURL = ""; npmDepsHash = "sha256-f5mw6IjkhZgsIuzCz9d7DvoAdceY1y+yWXn1BOonsVI=";
installPhase = '' installPhase = ''
mkdir $out mkdir $out
@ -23,38 +24,7 @@
''; '';
}; };
packages.erratic-gate-github-pages = packages.erratic-gate;
packages.default = 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="
# ];
};
# }}}
} }

View file

@ -15,38 +15,38 @@ import { initAutoSave } from './modules/simulation-actions/helpers/initAutoSave'
* The function wich does the heavy lifting for starting the app * The function wich does the heavy lifting for starting the app
*/ */
export const start = async () => { export const start = async () => {
// This will resolve at the first render // This will resolve at the first render
const result = loadSubject const result = loadSubject
.pipe( .pipe(
filter((a) => a), filter((a) => a),
take(1) take(1)
) )
.toPromise() .toPromise()
// Handle possible errors // Handle possible errors
handleErrors() handleErrors()
// Create main renderer for the app // Create main renderer for the app
initRenderer() initRenderer()
// Register key bindings // Register key bindings
initKeyBindings() initKeyBindings()
// Update base templates // Update base templates
initBaseTemplates() initBaseTemplates()
// Easter egg // Easter egg
logWelcome() logWelcome()
// Update the logic gates in local storage // Update the logic gates in local storage
updateLogicGateList() updateLogicGateList()
// start the autosaving stuff // start the autosaving stuff
initAutoSave() initAutoSave()
// Render app component // Render app component
render(<App />, document.getElementById('app')) render(<App />, document.getElementById('app'))
// wait for the first render // wait for the first render
await result await result
} }