Skip to content

Commit

Permalink
Clean up flake
Browse files Browse the repository at this point in the history
  • Loading branch information
prescientmoon committed Oct 12, 2024
1 parent 99bc2e3 commit 05e2528
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 80 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"semi": false,
"trailingComma": "none",
"singleQuote": true,
"printWidth": 80,
"tabWidth": 2
"semi": false,
"trailingComma": "none",
"singleQuote": true,
"printWidth": 80,
"tabWidth": 2
}
17 changes: 10 additions & 7 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

54 changes: 12 additions & 42 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,60 +1,30 @@
{
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
cp -r dist $out/www
'';
};

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="
# ];
};
# }}}
}

50 changes: 25 additions & 25 deletions src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(<App />, document.getElementById('app'))
// Render app component
render(<App />, document.getElementById('app'))

// wait for the first render
await result
// wait for the first render
await result
}

0 comments on commit 05e2528

Please sign in to comment.