diff options
Diffstat (limited to 'modules/zrepl.nix')
-rw-r--r-- | modules/zrepl.nix | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/modules/zrepl.nix b/modules/zrepl.nix deleted file mode 100644 index 5bcc17b..0000000 --- a/modules/zrepl.nix +++ /dev/null | |||
@@ -1,45 +0,0 @@ | |||
1 | { config, lib, pkgs, ... }: | ||
2 | let | ||
3 | cfg = config.services.zrepl; | ||
4 | in | ||
5 | { | ||
6 | options = { | ||
7 | services.zrepl = { | ||
8 | enable = lib.mkEnableOption "Enable the zrepl daemon"; | ||
9 | |||
10 | config = lib.mkOption { | ||
11 | type = lib.types.lines; | ||
12 | default = ""; | ||
13 | description = "Configuration"; | ||
14 | }; | ||
15 | }; | ||
16 | }; | ||
17 | |||
18 | config = lib.mkIf cfg.enable { | ||
19 | secrets.keys = { | ||
20 | "zrepl/zrepl.yml" = { | ||
21 | permissions = "0400"; | ||
22 | text = cfg.config; | ||
23 | user = config.systemd.services.zrepl.serviceConfig.User or "root"; | ||
24 | group = config.systemd.services.zrepl.serviceConfig.Group or "root"; | ||
25 | }; | ||
26 | }; | ||
27 | services.filesWatcher.zrepl = { | ||
28 | restart = true; | ||
29 | paths = [ config.secrets.fullPaths."zrepl/zrepl.yml" ]; | ||
30 | }; | ||
31 | systemd.services.zrepl = { | ||
32 | description = "zrepl daemon"; | ||
33 | wantedBy = [ "multi-user.target" ]; | ||
34 | path = [ pkgs.zfs pkgs.openssh ]; | ||
35 | serviceConfig = { | ||
36 | ExecStart = | ||
37 | let configFile = config.secrets.fullPaths."zrepl/zrepl.yml"; | ||
38 | in "${pkgs.zrepl}/bin/zrepl daemon --config ${configFile}"; | ||
39 | Type = "simple"; | ||
40 | RuntimeDirectory= "zrepl"; | ||
41 | RuntimeDirectoryMode= "0700"; | ||
42 | }; | ||
43 | }; | ||
44 | }; | ||
45 | } | ||