git commit -am "Pruned git history"
All checks were successful
Rebuild signaller for deprived.dev to rebuild site / Rebuild Signaller (push) Successful in 21s
All checks were successful
Rebuild signaller for deprived.dev to rebuild site / Rebuild Signaller (push) Successful in 21s
This commit is contained in:
commit
158918c0f5
201 changed files with 24558 additions and 0 deletions
35
flake.nix
Normal file
35
flake.nix
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
{
|
||||
description = "NPM project (dev shell + run, auto-install deps)";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, flake-utils }:
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
node = pkgs.nodejs_22; # or pkgs.nodejs_20
|
||||
|
||||
|
||||
start = pkgs.writeShellApplication {
|
||||
name = "start";
|
||||
runtimeInputs = [ node ];
|
||||
text = ''
|
||||
set -euo pipefail
|
||||
export npm_config_cache="$PWD/.npm-cache"
|
||||
if [ -f package-lock.json ]; then cmd=ci; else cmd=install; fi
|
||||
echo "→ npm $cmd (nix run)"
|
||||
${node}/bin/npm "$cmd"
|
||||
exec ${node}/bin/npm run dev -- "$@"
|
||||
'';
|
||||
};
|
||||
|
||||
in
|
||||
{
|
||||
devShells.default = pkgs.mkShell { buildInputs = [ node ]; shellHook = ''export npm_config_cache="$PWD/.npm-cache"''; };
|
||||
apps.default = { type = "app"; program = "${start}/bin/start"; };
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue