1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-08 11:36:05 +01:00

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>
This commit is contained in:
home-manager-ci[bot] 2025-07-23 11:30:31 -05:00 committed by GitHub
parent 9b9eb96dcd
commit 7b5a978e00
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 93 additions and 0 deletions

View file

@ -319,6 +319,7 @@ let
./programs/xmobar.nix
./programs/xplr.nix
./programs/yambar.nix
./programs/yarn/default.nix
./programs/yazi.nix
./programs/yt-dlp.nix
./programs/z-lua.nix

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;
};
};
};
};
}

View file

@ -414,6 +414,7 @@ import nmtSrc {
./modules/programs/wofi
./modules/programs/xmobar
./modules/programs/yambar
./modules/programs/yarn
./modules/programs/yt-dlp
./modules/services/activitywatch
./modules/services/avizo

View file

@ -0,0 +1,4 @@
{
yarn = ./example-config.nix;
yarn-empty-config = ./empty-config.nix;
}

View file

@ -0,0 +1,12 @@
{
programs.yarn = {
settings = {
httpProxy = "http://proxy.example.org:3128";
httpsProxy = "http://proxy.example.org:3128";
};
};
nmt.script = ''
assertPathNotExists home-files/.yarnrc.yml
'';
}

View file

@ -0,0 +1,20 @@
{
programs.yarn = {
enable = true;
settings = {
httpProxy = "http://proxy.example.org:3128";
httpsProxy = "http://proxy.example.org:3128";
};
};
nmt.script =
let
configPath = "home-files/.yarnrc.yml";
in
''
assertFileExists ${configPath}
assertFileContent ${configPath} \
${./example-config.yml}
'';
}

View file

@ -0,0 +1,2 @@
httpProxy: http://proxy.example.org:3128
httpsProxy: http://proxy.example.org:3128