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
.parcel-cache
.aider*

12
flake.lock generated
View File

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

View File

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