nixos-configs/apps/update/default.nix
matt1432 0fa79307c1
All checks were successful
Discord / discord commits (push) Has been skipped
feat(ags): install node_modules in nix
2024-08-06 20:35:11 -04:00

33 lines
750 B
Nix

{
lib,
buildNpmPackage,
callPackage,
makeWrapper,
nodejs_latest,
...
}: let
inherit (lib) concatMapStringsSep getBin;
inherit (builtins) readFile fromJSON;
packageJSON = fromJSON (readFile ./package.json);
in
buildNpmPackage rec {
pname = packageJSON.name;
inherit (packageJSON) version;
src = ./.;
npmDepsHash = "sha256-qpnQSJNl68LrsU8foJYxdBXpoFj7VKQahC9DFmleWTs=";
runtimeInputs = [
(callPackage ../../nixosModules/docker/updateImage.nix {})
];
nativeBuildInputs = [makeWrapper];
postInstall = ''
wrapProgram $out/bin/${pname} \
--prefix PATH : ${concatMapStringsSep ":" (p: getBin p) runtimeInputs}
'';
nodejs = nodejs_latest;
meta.mainProgram = pname;
}