staging again

This commit is contained in:
alsaiduq-lab 2025-04-01 11:36:16 -06:00
parent 4cea0a966e
commit ad06ac826e
3 changed files with 41 additions and 1 deletions

View file

@ -7,7 +7,7 @@
rpcs3
ryujinx
mupen64plus
dolphin-emulator
dolphin-emu
retroarch
mednafen
joycond

View file

@ -7,9 +7,11 @@
in {
imports = [
../modules/python.nix
../modules/npm.nix
];
python.enable = true;
npm.enable = true;
environment.systemPackages = with pkgs; [
brave # TODO: make a module to save browser stuff

38
modules/npm.nix Normal file
View file

@ -0,0 +1,38 @@
{
config,
pkgs,
lib,
...
}: let
npmConf = pkgs.writeText "npmrc" ''
prefix=${config.environment.variables.NPM_CONFIG_PREFIX}
cache=$HOME/.npm
init-module=$HOME/.npm-init.js
node-linker=hoisted
'';
in {
options.npm = {
enable = lib.mkEnableOption "System NPM Environment";
};
config = lib.mkIf config.npm.enable {
environment.systemPackages = with pkgs; [
nodejs
nodePackages.npm
];
environment.variables = {
NPM_CONFIG_PREFIX = "$HOME/.npm-global";
PATH = ["$HOME/.npm-global/bin"];
NPM_CONFIG_USERCONFIG = "${npmConf}";
};
system.userActivationScripts.setupNpm = ''
mkdir -p $HOME/.npm-global/bin
mkdir -p $HOME/.npm
if [ ! -f "$HOME/.npmrc" ]; then
cp ${npmConf} $HOME/.npmrc
fi
if [ -d "$HOME/.npm-global" ]; then
chmod -R +rw $HOME/.npm-global
fi
'';
};
}