]> git.immae.eu Git - perso/Immae/Config/Nix.git/blob - modules/zrepl.nix
Remove taskwarrior keys from the store for taskwarrior
[perso/Immae/Config/Nix.git] / modules / zrepl.nix
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 {
21 dest = "zrepl/zrepl.yml";
22 permissions = "0400";
23 text = cfg.config;
24 user = config.systemd.services.zrepl.serviceConfig.User or "root";
25 group = config.systemd.services.zrepl.serviceConfig.Group or "root";
26 }
27 ];
28 services.filesWatcher.zrepl = {
29 restart = true;
30 paths = [ config.secrets.fullPaths."zrepl/zrepl.yml" ];
31 };
32 systemd.services.zrepl = {
33 description = "zrepl daemon";
34 wantedBy = [ "multi-user.target" ];
35 path = [ pkgs.zfs pkgs.openssh ];
36 serviceConfig = {
37 ExecStart =
38 let configFile = config.secrets.fullPaths."zrepl/zrepl.yml";
39 in "${pkgs.zrepl}/bin/zrepl daemon --config ${configFile}";
40 Type = "simple";
41 RuntimeDirectory= "zrepl";
42 RuntimeDirectoryMode= "0700";
43 };
44 };
45 };
46 }