1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-12-05 16:41:04 +01:00

yarn: add module (#7526)

This commit is contained in:
Friedrich Altheide 2025-07-23 17:42:37 +02:00 committed by GitHub
parent b4752b0eda
commit e9c599e40c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 91 additions and 0 deletions

View file

@ -0,0 +1,53 @@
{
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;
};
};
};
};
}