{ description = "buildfor_life_repair - Vintage equipment inventory & repair tracker"; inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; flake-utils.url = "github:numtide/flake-utils"; }; outputs = { self, nixpkgs, flake-utils }: flake-utils.lib.eachDefaultSystem (system: let pkgs = import nixpkgs { inherit system; }; nodejs = pkgs.nodejs_20; in { # Development shell: `nix develop` devShells.default = pkgs.mkShell { buildInputs = [ nodejs pkgs.postgresql_16 pkgs.pkg-config pkgs.vips # required by sharp ]; shellHook = '' echo "buildfor_life_repair dev shell" echo " node: $(node --version)" echo " npm: $(npm --version)" echo "" echo "Run 'npm install' then 'npm run dev' to start." ''; }; # Production package: `nix build` packages.default = pkgs.buildNpmPackage rec { pname = "buildfor_life_repair"; version = "0.1.0"; src = ./.; npmDepsHash = ""; # Run `nix build` once to get the correct hash nativeBuildInputs = [ pkgs.pkg-config pkgs.python3 # needed by some native modules ]; buildInputs = [ pkgs.vips # sharp pkgs.glib pkgs.expat ]; npmBuildScript = "build"; installPhase = '' runHook preInstall mkdir -p $out/lib/buildfor_life_repair cp -r build/* $out/lib/buildfor_life_repair/ cp -r node_modules $out/lib/buildfor_life_repair/ cp package.json $out/lib/buildfor_life_repair/ mkdir -p $out/bin cat > $out/bin/buildfor_life_repair <