make nix run work

This commit is contained in:
Greg Shuflin 2025-04-07 19:34:09 -07:00
parent b8265ae360
commit fa77f6364c
3 changed files with 34 additions and 31 deletions

1
.gitignore vendored
View File

@ -9,3 +9,4 @@ node_modules/
!.yarn/versions !.yarn/versions
.parcel-cache .parcel-cache
.aider*

12
flake.lock generated
View File

@ -5,11 +5,11 @@
"systems": "systems" "systems": "systems"
}, },
"locked": { "locked": {
"lastModified": 1692799911, "lastModified": 1731533236,
"narHash": "sha256-3eihraek4qL744EvQXsK1Ha6C3CR7nnT8X2qWap4RNk=", "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide", "owner": "numtide",
"repo": "flake-utils", "repo": "flake-utils",
"rev": "f9e7cf818399d17d347f847525c5a5a8032e4e44", "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -20,11 +20,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1693250523, "lastModified": 1743964447,
"narHash": "sha256-y3up5gXMTbnCsXrNEB5j+7TVantDLUYyQLu/ueiXuyg=", "narHash": "sha256-nEo1t3Q0F+0jQ36HJfbJtiRU4OI+/0jX/iITURKe3EE=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "3efb0f6f404ec8dae31bdb1a9b17705ce0d6986e", "rev": "063dece00c5a77e4a0ea24e5e5a5bd75232806f8",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@ -6,9 +6,13 @@
flake-utils.url = "github:numtide/flake-utils"; flake-utils.url = "github:numtide/flake-utils";
}; };
outputs = { self, nixpkgs, flake-utils }: outputs = {
flake-utils.lib.eachDefaultSystem (system: self,
let nixpkgs,
flake-utils,
}:
flake-utils.lib.eachDefaultSystem (
system: let
pkgs = nixpkgs.legacyPackages.${system}; pkgs = nixpkgs.legacyPackages.${system};
node-modules = pkgs.mkYarnPackage { node-modules = pkgs.mkYarnPackage {
name = "node-modules"; name = "node-modules";
@ -27,7 +31,7 @@
installPhase = '' installPhase = ''
mkdir -p $out mkdir -p $out
cp -r dist/* $out/ cp -r dist/* $out/
# Create a bin directory with a wrapper script # Create a bin directory with a wrapper script
mkdir -p $out/bin mkdir -p $out/bin
cat > $out/bin/frontend <<EOF cat > $out/bin/frontend <<EOF
@ -37,26 +41,24 @@
chmod +x $out/bin/frontend chmod +x $out/bin/frontend
''; '';
}; };
in in {
{ packages = {
packages = { node-modules = node-modules;
node-modules = node-modules; default = frontend;
default = frontend; };
};
apps.default = {
apps.default = { type = "app";
type = "app"; program = "${frontend}/bin/frontend";
program = "${frontend}/bin/frontend"; };
};
devShells.default = pkgs.mkShell {
devShells.default = pkgs.mkShell { buildInputs = [
buildInputs = [ pkgs.nodejs
pkgs.nodejs pkgs.yarn
pkgs.yarn pkgs.nodePackages.typescript
pkgs.nodePackages.typescript ];
]; };
}; }
}
); );
} }