mirror of
https://github.com/nix-community/home-manager
synced 2024-11-30 06:59:45 +01:00
parent
ded327b9fc
commit
1dd226fde7
7 changed files with 114 additions and 0 deletions
2
.github/CODEOWNERS
vendored
2
.github/CODEOWNERS
vendored
|
@ -22,6 +22,8 @@
|
|||
|
||||
/modules/misc/xdg-user-dirs.nix @pacien
|
||||
|
||||
/modules/programs/aria2.nix @JustinLovinger
|
||||
|
||||
/modules/programs/autorandr.nix @uvNikita
|
||||
|
||||
/modules/programs/bash.nix @rycee
|
||||
|
|
|
@ -1496,6 +1496,13 @@ in
|
|||
A new module is available: 'programs.i3status'
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2020-05-03T11:21:42+00:00";
|
||||
message = ''
|
||||
A new module is available: 'programs.aria2'
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -45,6 +45,7 @@ let
|
|||
(loadModule ./programs/afew.nix { })
|
||||
(loadModule ./programs/alacritty.nix { })
|
||||
(loadModule ./programs/alot.nix { })
|
||||
(loadModule ./programs/aria2.nix { })
|
||||
(loadModule ./programs/astroid.nix { })
|
||||
(loadModule ./programs/autorandr.nix { })
|
||||
(loadModule ./programs/bash.nix { })
|
||||
|
|
61
modules/programs/aria2.nix
Normal file
61
modules/programs/aria2.nix
Normal file
|
@ -0,0 +1,61 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.programs.aria2;
|
||||
|
||||
formatLine = n: v:
|
||||
let
|
||||
formatValue = v:
|
||||
if builtins.isBool v then
|
||||
(if v then "true" else "false")
|
||||
else
|
||||
toString v;
|
||||
in "${n}=${formatValue v}";
|
||||
in {
|
||||
meta.maintainers = [ hm.maintainers.justinlovinger ];
|
||||
|
||||
options.programs.aria2 = {
|
||||
enable = mkEnableOption "aria2";
|
||||
|
||||
settings = mkOption {
|
||||
type = with types; attrsOf (oneOf [ bool float int str ]);
|
||||
default = { };
|
||||
description = ''
|
||||
Options to add to <filename>aria2.conf</filename> file.
|
||||
See
|
||||
<citerefentry>
|
||||
<refentrytitle>aria2c</refentrytitle>
|
||||
<manvolnum>1</manvolnum>
|
||||
</citerefentry>
|
||||
for options.
|
||||
'';
|
||||
example = literalExample ''
|
||||
{
|
||||
listen-port = 60000;
|
||||
dht-listen-port = 60000;
|
||||
seed-ratio = 1.0;
|
||||
max-upload-limit = "50K";
|
||||
ftp-pasv = true;
|
||||
}
|
||||
'';
|
||||
};
|
||||
|
||||
extraConfig = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
description = ''
|
||||
Extra lines added to <filename>aria2.conf</filename> file.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = [ pkgs.aria2 ];
|
||||
|
||||
xdg.configFile."aria2/aria2.conf".text = concatStringsSep "\n" ([ ]
|
||||
++ mapAttrsToList formatLine cfg.settings
|
||||
++ optional (cfg.extraConfig != "") cfg.extraConfig);
|
||||
};
|
||||
}
|
|
@ -36,6 +36,7 @@ import nmt {
|
|||
./modules/misc/fontconfig
|
||||
./modules/programs/alacritty
|
||||
./modules/programs/alot
|
||||
./modules/programs/aria2
|
||||
./modules/programs/bash
|
||||
./modules/programs/browserpass
|
||||
./modules/programs/fish
|
||||
|
|
1
tests/modules/programs/aria2/default.nix
Normal file
1
tests/modules/programs/aria2/default.nix
Normal file
|
@ -0,0 +1 @@
|
|||
{ aria2-settings = ./settings.nix; }
|
41
tests/modules/programs/aria2/settings.nix
Normal file
41
tests/modules/programs/aria2/settings.nix
Normal file
|
@ -0,0 +1,41 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
config = {
|
||||
programs.aria2 = {
|
||||
enable = true;
|
||||
|
||||
settings = {
|
||||
listen-port = 60000;
|
||||
dht-listen-port = 60000;
|
||||
seed-ratio = 1.0;
|
||||
max-upload-limit = "50K";
|
||||
ftp-pasv = true;
|
||||
};
|
||||
|
||||
extraConfig = ''
|
||||
# Extra aria2 configuration.
|
||||
'';
|
||||
};
|
||||
|
||||
nixpkgs.overlays =
|
||||
[ (self: super: { aria2 = pkgs.writeScriptBin "dummy-aria2" ""; }) ];
|
||||
|
||||
nmt.script = ''
|
||||
assertFileContent \
|
||||
home-files/.config/aria2/aria2.conf \
|
||||
${
|
||||
pkgs.writeText "aria2-expected-config.conf" ''
|
||||
dht-listen-port=60000
|
||||
ftp-pasv=true
|
||||
listen-port=60000
|
||||
max-upload-limit=50K
|
||||
seed-ratio=1.000000
|
||||
# Extra aria2 configuration.
|
||||
''
|
||||
}
|
||||
'';
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue