1 { config, lib, pkgs, ... }:
6 cfg = config.programs.npm;
14 enable = mkEnableOption (lib.mdDoc "{command}`npm` global config");
18 description = lib.mdDoc "The npm package version / flavor to use";
19 default = pkgs.nodePackages.npm;
20 defaultText = literalExpression "pkgs.nodePackages.npm";
21 example = literalExpression "pkgs.nodePackages_13_x.npm";
25 type = lib.types.lines;
26 description = lib.mdDoc ''
27 The system-wide npm configuration.
28 See <https://docs.npmjs.com/misc/config>.
31 prefix = ''${HOME}/.npm
34 prefix = ''${HOME}/.npm
35 https-proxy=proxy.example.com
37 init-author-url=http://npmjs.org
46 config = lib.mkIf cfg.enable {
47 environment.etc.npmrc.text = cfg.npmrc;
49 environment.variables.NPM_CONFIG_GLOBALCONFIG = "/etc/npmrc";
51 environment.systemPackages = [ cfg.package ];