-
Notifications
You must be signed in to change notification settings - Fork 0
/
module.nix
89 lines (79 loc) · 2.11 KB
/
module.nix
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
{chromexup-src}: {
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.programs.chromexup;
iniFormat = pkgs.formats.ini {};
package = pkgs.callPackage ./pkg.nix {inherit chromexup-src;};
in {
options.programs.chromexup = {
enable = mkEnableOption "chromexup";
branding = mkOption {
type = types.enum ["inox" "iridium" "chromium"];
default = "chromium";
description = "Name of the browser user data directory.";
};
parallelDownloads = mkOption {
type = types.int;
default = 4;
description = "Parallel download threads.";
};
removeOrphans = mkOption {
type = types.bool;
# should do this by default to have more nixos-like behavior
default = true;
description = "Remove extensions not defined in the extension section.";
};
extensions = mkOption {
type = types.attrsOf types.str;
default = {};
description = "List of browser extensions to manage.";
example = {
HTTPSEverywhere = "gcbommkclmclpchllfjekcdonpmejbdp";
};
};
};
config = mkIf cfg.enable {
home.packages = [
package
];
xdg.configFile."chromexup/config.ini".source = iniFormat.generate "config.ini" {
main = {
branding = cfg.branding;
parallel_downloads = toString cfg.parallelDownloads;
remove_orphans =
if cfg.removeOrphans
then "True"
else "False";
};
extensions = cfg.extensions;
};
systemd.user.timers.chromexup = {
Unit = {
Description = "Run chromexup daily";
};
Timer = {
OnActiveSec = 10;
OnCalendar = "daily";
Persistent = true;
};
Install = {
WantedBy = ["timers.target"];
};
};
systemd.user.services.chromexup = {
Unit = {
Description = "External extension updater for Chromium based browsers";
After = ["network-online.target" "psd-resync.service"];
Wants = ["network-online.target"];
};
Service = {
Type = "simple";
ExecStart = "${package}/bin/chromexup";
};
};
};
}