mirror of
https://github.com/nix-community/dream2nix.git
synced 2024-11-29 23:35:33 +03:00
add: create devShell
This commit is contained in:
parent
1690984d06
commit
96e8a0e297
@ -196,6 +196,10 @@
|
||||
then "copy"
|
||||
else "symlink";
|
||||
|
||||
passthru.devShell = import ./devShell.nix {
|
||||
inherit nodejs pkg pkgs;
|
||||
};
|
||||
|
||||
unpackCmd =
|
||||
if lib.hasSuffix ".tgz" src
|
||||
then "tar --delay-directory-restore -xf $src"
|
||||
@ -314,7 +318,15 @@
|
||||
"${name}"."${version}" = allPackages."${name}"."${version}";
|
||||
})
|
||||
packages);
|
||||
devShells =
|
||||
{default = devShells.${defaultPackageName};}
|
||||
// (
|
||||
l.mapAttrs
|
||||
(name: version: allPackages.${name}.${version}.devShell)
|
||||
packages
|
||||
);
|
||||
in {
|
||||
packages = mainPackages;
|
||||
inherit devShells;
|
||||
};
|
||||
}
|
||||
|
27
src/subsystems/nodejs/builders/strict-builder/devShell.nix
Normal file
27
src/subsystems/nodejs/builders/strict-builder/devShell.nix
Normal file
@ -0,0 +1,27 @@
|
||||
{
|
||||
nodejs,
|
||||
pkg,
|
||||
pkgs,
|
||||
}:
|
||||
with pkgs;
|
||||
mkShell {
|
||||
buildInputs = [
|
||||
nodejs
|
||||
];
|
||||
shellHook = let
|
||||
nodeModulesDir = pkg.deps;
|
||||
in ''
|
||||
# rsync the node_modules folder
|
||||
# is way faster than copying everything again, because it only replaces updated files
|
||||
|
||||
# current Options:
|
||||
# -a -> all files recursive, preserve symlinks, etc.
|
||||
# -c -> calculate hashsums
|
||||
# -E -> preserve executables
|
||||
# --delete -> removes deleted files
|
||||
${rsync}/bin/rsync -acE --delete ${nodeModulesDir}/* ./node_modules/
|
||||
|
||||
chmod -R +w ./node_modules
|
||||
export PATH="$PATH:$(realpath ./node_modules)/.bin"
|
||||
'';
|
||||
}
|
Loading…
Reference in New Issue
Block a user