-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmodule.nix
More file actions
47 lines (36 loc) · 972 Bytes
/
module.nix
File metadata and controls
47 lines (36 loc) · 972 Bytes
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
{ pkgs, lib, config, ... }:
with lib;
let
cfg = config.services.pullomatic;
repoFormat = pkgs.formats.yaml { };
repos = pkgs.linkFarm "pullomatic.config" (mapAttrsToList
(name: val: {
inherit name;
path = repoFormat.generate "${name}.yaml" val;
})
cfg.repos);
pullomatic = pkgs.callPackage ./package.nix { };
in
{
options.services.pullomatic = {
enable = mkEnableOption "pullomatic";
repos = mkOption {
type = types.attrsOf (repoFormat.type);
default = { };
};
};
config = mkIf cfg.enable {
systemd.services.pullomatic = {
description = "Pullomatic";
requires = [ "network-online.target" ];
after = [ "network-online.target" ];
wantedBy = [ "multi-user.target" ];
restartTriggers = [ repos ];
serviceConfig = {
Type = "simple";
Restart = "always";
ExecStart = "${pullomatic}/bin/pullomatic --config '${repos}'";
};
};
};
}