This repository has been archived on 2022-09-16. You can view files and clone it, but cannot push or open issues or pull requests.
tlaternet-templates/nix/package.nix

47 lines
809 B
Nix
Raw Normal View History

2022-08-01 21:14:18 +01:00
{
self,
nix-filter,
pkgs,
}: let
2022-08-03 01:47:50 +01:00
inherit (pkgs.lib) cleanSource;
2022-08-01 21:14:18 +01:00
node_modules_attrs = {
# Dependencies that should be available in the node build
buildInputs = with pkgs; [
pkg-config
python3
vips
glib
];
};
# Dependencies that should be available outside of the node build
buildInputs = with pkgs; [
util-linux
];
in {
package = pkgs.npmlock2nix.build {
inherit buildInputs node_modules_attrs;
2022-08-03 01:47:50 +01:00
src = cleanSource self;
2022-08-01 21:14:18 +01:00
buildCommands = ["npm run build-dist"];
installPhase = ''
cp -r dist $out/
'';
};
shell = pkgs.npmlock2nix.shell {
inherit buildInputs node_modules_attrs;
2022-08-03 01:47:50 +01:00
src = nix-filter {
2022-08-01 21:14:18 +01:00
root = self;
include = [
"package.json"
"package-lock.json"
];
};
};
}