nix flake so sveske and spoody busts

This commit is contained in:
BOTAlex 2025-10-02 05:51:10 +02:00
parent e6c498b0c2
commit b7524b10da
504 changed files with 2166 additions and 0 deletions

46
flake.nix Normal file
View file

@ -0,0 +1,46 @@
{
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 = ''
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 (dev shell)"
${node}/bin/npm "$cmd"
'';
};
apps.default = {
type = "app";
program = "${start}/bin/start";
};
});
}