{ inputs = { nix.url = "git+ssh://git@git.c3c.cz/C3C/nix"; }; outputs = { self, nix }: { formatter = nix.formatter; packages = nix.lib.forAllSystems ( pkgs: let version = "rev-${self.shortRev or self.dirtyShortRev}"; package = builtins.fromJSON (builtins.readFile ./app/frontend/package.json); in rec { ui = pkgs.buildNpmPackage { inherit version; pname = "cv"; src = ./app/frontend; npmInstallFlags = "--no-audit --no-progress --no-fund"; npmDepsHash = "sha256-p4rTpy0t8aajbubvtF1TA83/FFqvfKEOPBb5T0ZRfQY="; npmPackFlags = [ "--ignore-scripts" ]; }; server = pkgs.buildGoModule { inherit version; pname = "cv"; CGO_ENABLED = 0; src = ./.; subPackages = [ "app/server" ]; postPatch = '' rm -rf app/server/internal/files/data/public mkdir -p app/server/internal/files/data/public touch app/server/internal/files/data/public/.gitkeep cp -Tr ${ui}/lib/node_modules/${package.name}/dist app/server/internal/files/data/public/ chmod +w -R app/server/internal/files/data/public sed -i 's# /dev/null) [[ ''$HASH = sha256* ]] && echo "Hash is ''$HASH" [[ ''$HASH != sha256* ]] && echo "Failed" && exit 137 # Replace the first occurence of npmDepsHash with the new calculated hash in this file sed -i "0,/npmDepsHash =/{s@npmDepsHash = .*@npmDepsHash = \"''$HASH\";@}" ./flake.nix ''; } { name = "dev"; help = "Starts the javascript project in dev"; command = '' npm --prefix ''$PRJ_ROOT/app/frontend run dev ''; } ]; }; }); }; }