mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-08 11:36:05 +01:00
(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:
parent
9b9eb96dcd
commit
7b5a978e00
7 changed files with 93 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
53
modules/programs/yarn/default.nix
Normal file
53
modules/programs/yarn/default.nix
Normal 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;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -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
|
||||
|
|
|
|||
4
tests/modules/programs/yarn/default.nix
Normal file
4
tests/modules/programs/yarn/default.nix
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
yarn = ./example-config.nix;
|
||||
yarn-empty-config = ./empty-config.nix;
|
||||
}
|
||||
12
tests/modules/programs/yarn/empty-config.nix
Normal file
12
tests/modules/programs/yarn/empty-config.nix
Normal 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
|
||||
'';
|
||||
}
|
||||
20
tests/modules/programs/yarn/example-config.nix
Normal file
20
tests/modules/programs/yarn/example-config.nix
Normal 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}
|
||||
'';
|
||||
}
|
||||
2
tests/modules/programs/yarn/example-config.yml
Normal file
2
tests/modules/programs/yarn/example-config.yml
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
httpProxy: http://proxy.example.org:3128
|
||||
httpsProxy: http://proxy.example.org:3128
|
||||
Loading…
Add table
Add a link
Reference in a new issue