1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-28 21:21:02 +01:00
home-manager/modules/programs/yarn/default.nix
Friedrich Altheide 0b9bf983db yarn: improve docs
(cherry picked from commit a1817d1c0e)
2025-07-25 16:43:59 -05:00

53 lines
1,012 B
Nix

{
lib,
pkgs,
config,
...
}:
let
inherit (lib)
mkIf
mkEnableOption
mkOption
;
cfg = config.programs.yarn;
yamlFormat = pkgs.formats.yaml { };
in
{
meta.maintainers = [ lib.maintainers.friedrichaltheide ];
options.programs.yarn = {
enable = mkEnableOption "management of yarn config";
settings = mkOption {
type = yamlFormat.type;
default = { };
example = lib.literalExpression ''
{
httpProxy = "http://proxy.example.org:3128";
httpsProxy = "http://proxy.example.org:3128";
}
'';
description = ''
Available configuration options for yarn see:
<https://yarnpkg.com/configuration/yarnrc>
'';
};
};
config = mkIf cfg.enable {
home = {
file =
let
yarnRcFileName = ".yarnrc.yml";
in
{
"${yarnRcFileName}" = {
source = yamlFormat.generate "${yarnRcFileName}" cfg.settings;
};
};
};
};
}