1 { config, lib, pkgs, ... }:
4 cfg = config.programs.npm;
12 enable = lib.mkEnableOption "{command}`npm` global config";
14 package = lib.mkPackageOption pkgs [ "nodePackages" "npm" ] {
15 example = "nodePackages_13_x.npm";
18 npmrc = lib.mkOption {
19 type = lib.types.lines;
21 The system-wide npm configuration.
22 See <https://docs.npmjs.com/misc/config>.
25 prefix = ''${HOME}/.npm
28 prefix = ''${HOME}/.npm
29 https-proxy=proxy.example.com
31 init-author-url=https://www.npmjs.com/
40 config = lib.mkIf cfg.enable {
41 environment.etc.npmrc.text = cfg.npmrc;
43 environment.variables.NPM_CONFIG_GLOBALCONFIG = "/etc/npmrc";
45 environment.systemPackages = [ cfg.package ];