fixes npm (for real)
This commit is contained in:
parent
ebadab59f6
commit
0003663a8c
3 changed files with 26 additions and 24 deletions
|
|
@ -7,10 +7,8 @@
|
||||||
if [ -d "$HOME/.cargo/bin" ]; then
|
if [ -d "$HOME/.cargo/bin" ]; then
|
||||||
export PATH="$PATH:$HOME/.cargo/bin"
|
export PATH="$PATH:$HOME/.cargo/bin"
|
||||||
fi
|
fi
|
||||||
if [ -d "$HOME/.npm-global/bin" ]; then
|
|
||||||
export PATH="$PATH:$HOME/.npm-global/bin"
|
|
||||||
fi
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
environment.variables = {
|
environment.variables = {
|
||||||
EDITOR = "nvim";
|
EDITOR = "nvim";
|
||||||
VISUAL = "nvim";
|
VISUAL = "nvim";
|
||||||
|
|
|
||||||
|
|
@ -5,43 +5,47 @@
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
npmConf = pkgs.writeText "npmrc" ''
|
npmConf = pkgs.writeText "npmrc" ''
|
||||||
prefix=${"$"}{HOME}/.npm-global
|
prefix=${"$"}HOME/.npm-global
|
||||||
cache=${"$"}{HOME}/.npm
|
cache=${"$"}HOME/.npm
|
||||||
init-module=${"$"}{HOME}/.npm-init.js
|
init-module=${"$"}HOME/.npm-init.js
|
||||||
'';
|
'';
|
||||||
in {
|
in {
|
||||||
options.npm.enable = lib.mkEnableOption "system-wide npm environment";
|
options.npm.enable = lib.mkEnableOption "system-wide npm environment";
|
||||||
|
|
||||||
config = lib.mkIf config.npm.enable {
|
config = lib.mkIf config.npm.enable {
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
nodejs_22
|
nodejs_23
|
||||||
nodePackages.npm
|
nodePackages.npm
|
||||||
yarn
|
yarn
|
||||||
bun
|
bun
|
||||||
pnpm
|
|
||||||
electron
|
|
||||||
nodePackages.typescript
|
nodePackages.typescript
|
||||||
nodePackages.prettier
|
|
||||||
nodePackages.eslint
|
|
||||||
nodePackages.sql-formatter
|
|
||||||
nodePackages.markdownlint-cli
|
|
||||||
nodePackages.stylelint
|
|
||||||
nodePackages.htmlhint
|
|
||||||
nodePackages.jsonlint
|
|
||||||
];
|
];
|
||||||
|
|
||||||
environment.sessionVariables.PATH =
|
|
||||||
lib.mkAfter ":${"$"}{HOME}/.npm-global/bin";
|
|
||||||
|
|
||||||
environment.etc."npmrc".source = npmConf;
|
environment.etc."npmrc".source = npmConf;
|
||||||
|
|
||||||
systemd.user.services."npm-setup" = {
|
systemd.user.services.npm-global-dir = {
|
||||||
description = "Install .npmrc";
|
|
||||||
wantedBy = ["default.target"];
|
wantedBy = ["default.target"];
|
||||||
script = ''
|
script = ''
|
||||||
install -m600 -D ${npmConf} "$HOME/.npmrc"
|
mkdir -p $HOME/.npm-global/bin
|
||||||
|
chmod u+rwx $HOME/.npm-global
|
||||||
'';
|
'';
|
||||||
serviceConfig.Type = "oneshot";
|
serviceConfig = {
|
||||||
|
Type = "oneshot";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.user.services.npm-setup = {
|
||||||
|
wantedBy = ["default.target"];
|
||||||
|
script = ''
|
||||||
|
if [ ! -f ~/.npmrc ]; then
|
||||||
|
cp ${npmConf} ~/.npmrc
|
||||||
|
chmod u+rw ~/.npmrc
|
||||||
|
fi
|
||||||
|
'';
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "oneshot";
|
||||||
|
RemainAfterExit = true;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@
|
||||||
./modules/libs.nix
|
./modules/libs.nix
|
||||||
./modules/rgb.nix
|
./modules/rgb.nix
|
||||||
];
|
];
|
||||||
|
programs.npm.enable = true;
|
||||||
services.udisks2.enable = true;
|
services.udisks2.enable = true;
|
||||||
|
|
||||||
# Some programs need SUID wrappers, can be configured further or are
|
# Some programs need SUID wrappers, can be configured further or are
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue