An experiment in improving node packaging for nix. Dead simple.
Nix
43
27 commits
updated Sep 4, 2024
The dumbest node to Nix packaging solution yet!
Status: This project has been integrated into nixpkgs as importNpmLock.
Map over package-lock.json packages, invoke correct fetcher
Update package.json & package-lock.lock to point to store paths
URLs are rewritten to file:... dependencies that link to the Nix store.
Run npm install
Our configure/shell hook links individual directories inside the Nix built node_modules directory.
This is to work around issues like https://github.com/nix-community/npmlock2nix/issues/86 and that tools like vite expects a writable node_modules.
default.nixstdenv.mkDerivation {
pname = "my-website";
version = "0.1.0";
src = ./.;
nativeBuildInputs = [
buildNodeModules.hooks.npmConfigHook
nodejs
nodejs.passthru.python # for node-gyp
npmHooks.npmBuildHook
npmHooks.npmInstallHook
];
npmDeps = buildNodeModules.fetchNodeModules {
npmRoot = ./.;
};
}
shell.nixpkgs.mkShell {
packages = [
buildNodeModules.hooks.linkNodeModulesHook
nodejs
];
npmDeps = buildNodeModules.buildNodeModules {
npmRoot = ./.;
inherit nodejs;
};
}
26 commits
1 commits
Nix
52.8%
JavaScript
37.1%
Shell
10.0%
An experiment in improving node packaging for nix. Dead simple.
Nix
43
27 commits
updated Sep 4, 2024
The dumbest node to Nix packaging solution yet!
Status: This project has been integrated into nixpkgs as importNpmLock.
Map over package-lock.json packages, invoke correct fetcher
Update package.json & package-lock.lock to point to store paths
URLs are rewritten to file:... dependencies that link to the Nix store.
Run npm install
Our configure/shell hook links individual directories inside the Nix built node_modules directory.
This is to work around issues like https://github.com/nix-community/npmlock2nix/issues/86 and that tools like vite expects a writable node_modules.
default.nixstdenv.mkDerivation {
pname = "my-website";
version = "0.1.0";
src = ./.;
nativeBuildInputs = [
buildNodeModules.hooks.npmConfigHook
nodejs
nodejs.passthru.python # for node-gyp
npmHooks.npmBuildHook
npmHooks.npmInstallHook
];
npmDeps = buildNodeModules.fetchNodeModules {
npmRoot = ./.;
};
}
shell.nixpkgs.mkShell {
packages = [
buildNodeModules.hooks.linkNodeModulesHook
nodejs
];
npmDeps = buildNodeModules.buildNodeModules {
npmRoot = ./.;
inherit nodejs;
};
}
26 commits
1 commits
Nix
52.8%
JavaScript
37.1%
Shell
10.0%