npm packages and ulimit

This commit is contained in:
Olaf Kolkman
2026-08-01 09:26:36 +02:00
parent f5be95e5c3
commit cc996f7550
2 changed files with 33 additions and 0 deletions
+4
View File
@@ -62,6 +62,9 @@ in
};
stateVersion = "23.11";
};
home.activation.ensureNpmCliTools = import ./npm.nix { inherit lib pkgs; };
catppuccin = {
autoEnable = true;
enable = true;
@@ -184,6 +187,7 @@ in
initContent =
let
zshConfigEarlyInit = lib.mkOrder 500 ''
ulimit -n 524288
if [[ -f /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh ]]; then
. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
. /nix/var/nix/profiles/default/etc/profile.d/nix.sh
+29
View File
@@ -0,0 +1,29 @@
{ lib, pkgs }:
let
npmPackages = [
"@enact/cli"
"@webos-tools/cli"
"patch-package"
];
in
lib.hm.dag.entryAfter [ "writeBoundary" ] ''
# Ensure required npm CLI tools are installed in the user prefix.
NPM_BIN="${pkgs.nodejs}/bin/npm"
export NPM_CONFIG_PREFIX="$HOME/.npm-packages"
export PATH="${pkgs.nodejs}/bin:$NPM_CONFIG_PREFIX/bin:$PATH"
if [[ ! -x "$NPM_BIN" ]]; then
echo "npm not found; skipping npm CLI installation step"
exit 0
fi
for pkg in ${lib.concatStringsSep " " (map lib.escapeShellArg npmPackages)}; do
if "$NPM_BIN" list -g --depth=0 "$pkg" >/dev/null 2>&1; then
echo "npm package already installed: $pkg"
else
echo "installing npm package: $pkg"
"$NPM_BIN" install -g "$pkg"
fi
done
''