add: create devShell

This commit is contained in:
hsjobeki 2022-12-30 21:17:23 +01:00
parent 1690984d06
commit 96e8a0e297
2 changed files with 39 additions and 0 deletions

View File

@ -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;
};
}

View 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"
'';
}