2.home-manager/modules/programs/yarn/default.nix
home-manager-ci[bot] 7b5a978e00
yarn: add module (#7526) (#7529)
(cherry picked from commit e9c599e40c)

Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
Co-authored-by: Friedrich Altheide <11352905+FriedrichAltheide@users.noreply.github.com>
2025-07-23 11:30:31 -05:00

53 lines
990 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 = ''
{
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;
};
};
};
};
}