···
100
+
config = lib.mkIf (cfg.filesystems != { }) {
101
+
systemd.packages = [ pkgs.bees ];
systemd.services = lib.mapAttrs' (
lib.nameValuePair "beesd@${name}" {
104
-
description = "Block-level BTRFS deduplication for %i";
105
-
after = [ "sysinit.target" ];
111
-
"verbosity=${toString fs.verbosity}"
112
-
"idxSizeMB=${toString fs.hashTableSizeMB}"
113
-
"workDir=${fs.workDir}"
105
+
overrideStrategy = "asDropin";
111
+
"verbosity=${toString fs.verbosity}"
112
+
"idxSizeMB=${toString fs.hashTableSizeMB}"
113
+
"workDir=${fs.workDir}"
115
+
configOptsStr = lib.escapeShellArgs configOpts;
119
+
"${pkgs.bees}/bin/bees-service-wrapper run ${configOptsStr} -- --no-timestamps ${lib.escapeShellArgs fs.extraOptions}"
115
-
configOptsStr = lib.escapeShellArgs configOpts;
118
-
# Values from https://github.com/Zygo/bees/blob/v0.6.5/scripts/beesd@.service.in
119
-
ExecStart = "${pkgs.bees}/bin/bees-service-wrapper run ${configOptsStr} -- --no-timestamps ${lib.escapeShellArgs fs.extraOptions}";
120
-
ExecStopPost = "${pkgs.bees}/bin/bees-service-wrapper cleanup ${configOptsStr}";
121
-
CPUAccounting = true;
122
-
CPUSchedulingPolicy = "batch";
124
-
IOSchedulingClass = "idle";
125
-
IOSchedulingPriority = 7;
127
-
KillMode = "control-group";
128
-
KillSignal = "SIGTERM";
129
-
MemoryAccounting = true;
131
-
Restart = "on-abnormal";
132
-
StartupCPUWeight = 25;
133
-
StartupIOWeight = 25;
134
-
SyslogIdentifier = "beesd"; # would otherwise be "bees-service-wrapper"
121
+
SyslogIdentifier = "beesd"; # would otherwise be "bees-service-wrapper"
unitConfig.RequiresMountsFor = lib.mkIf (lib.hasPrefix "/" fs.spec) fs.spec;
wantedBy = [ "multi-user.target" ];