blob: 43853dc42787b3a2ba08b8b446120c018c0e4e59 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# Command line download manager
{
config,
lib,
...
}:
let
cfg = config.web.aria2;
icons = config.desktop.icons.apps;
in
{
options.web.aria2 = {
enable = lib.mkEnableOption "Enables aria2.";
package = lib.mkOption {
type = lib.types.package;
readOnly = true;
default = config.programs.aria2.package;
description = "The aria2 package to use.";
};
};
config = lib.mkMerge [
(lib.mkIf cfg.enable {
programs.aria2 = {
enable = true;
settings = {
dir = "${config.home.homeDirectory}/Downloads";
};
systemd.enable = true;
};
})
(lib.mkIf (cfg.enable && config.desktop.enable) {
desktop.rofi.action.actions = [
{
name = "aria2 Start";
command = "systemctl --user start aria2";
icon = icons.aria2;
}
{
name = "aria2 Stop";
command = "systemctl --user stop aria2";
icon = icons.aria2;
}
];
})
];
}
|