25 lines
575 B
Nix
25 lines
575 B
Nix
{ config, lib, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
cfg = config.features.cli.node;
|
|
|
|
inherit (config.xdg) configHome dataHome stateHome;
|
|
in
|
|
{
|
|
options.features.cli.node.enable = mkEnableOption "Enable node";
|
|
|
|
config = mkIf cfg.enable {
|
|
xdg.configFile."${config.home.sessionVariables.NPM_CONFIG_USERCONFIG}".text = ''
|
|
cache=${configHome}/npm
|
|
init-module=${configHome}/npm/config/npm-init.js
|
|
logs-dir=${stateHome}/npm/logs
|
|
prefix=${dataHome}/npm
|
|
'';
|
|
|
|
home.sessionVariables = {
|
|
NPM_CONFIG_USERCONFIG = "${configHome}/npm/npmrc";
|
|
};
|
|
};
|
|
}
|