nixos-configs/apps/update/default.nix

34 lines
750 B
Nix
Raw Normal View History

{
lib,
buildNpmPackage,
callPackage,
makeWrapper,
nodejs_latest,
...
}: let
inherit (lib) concatMapStringsSep getBin;
inherit (builtins) readFile fromJSON;
packageJSON = fromJSON (readFile ./package.json);
in
buildNpmPackage rec {
2024-08-06 20:35:11 -04:00
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;
}