0
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-13 21:50:33 +03:00

nixos/bees: sync service configuration with upstream (#348054)

This commit is contained in:
Arne Keller 2025-04-03 08:24:44 +02:00 committed by GitHub
commit 9da6c7332e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -97,42 +97,29 @@ in
''; '';
}; };
}; };
config = { config = lib.mkIf (cfg.filesystems != { }) {
systemd.packages = [ pkgs.bees ];
systemd.services = lib.mapAttrs' ( systemd.services = lib.mapAttrs' (
name: fs: name: fs:
lib.nameValuePair "beesd@${name}" { lib.nameValuePair "beesd@${name}" {
description = "Block-level BTRFS deduplication for %i"; overrideStrategy = "asDropin";
after = [ "sysinit.target" ]; serviceConfig = {
ExecStart =
serviceConfig = let
let configOpts = [
configOpts = [ fs.spec
fs.spec "verbosity=${toString fs.verbosity}"
"verbosity=${toString fs.verbosity}" "idxSizeMB=${toString fs.hashTableSizeMB}"
"idxSizeMB=${toString fs.hashTableSizeMB}" "workDir=${fs.workDir}"
"workDir=${fs.workDir}" ];
configOptsStr = lib.escapeShellArgs configOpts;
in
[
""
"${pkgs.bees}/bin/bees-service-wrapper run ${configOptsStr} -- --no-timestamps ${lib.escapeShellArgs fs.extraOptions}"
]; ];
configOptsStr = lib.escapeShellArgs configOpts; SyslogIdentifier = "beesd"; # would otherwise be "bees-service-wrapper"
in };
{
# Values from https://github.com/Zygo/bees/blob/v0.6.5/scripts/beesd@.service.in
ExecStart = "${pkgs.bees}/bin/bees-service-wrapper run ${configOptsStr} -- --no-timestamps ${lib.escapeShellArgs fs.extraOptions}";
ExecStopPost = "${pkgs.bees}/bin/bees-service-wrapper cleanup ${configOptsStr}";
CPUAccounting = true;
CPUSchedulingPolicy = "batch";
CPUWeight = 12;
IOSchedulingClass = "idle";
IOSchedulingPriority = 7;
IOWeight = 10;
KillMode = "control-group";
KillSignal = "SIGTERM";
MemoryAccounting = true;
Nice = 19;
Restart = "on-abnormal";
StartupCPUWeight = 25;
StartupIOWeight = 25;
SyslogIdentifier = "beesd"; # would otherwise be "bees-service-wrapper"
};
unitConfig.RequiresMountsFor = lib.mkIf (lib.hasPrefix "/" fs.spec) fs.spec; unitConfig.RequiresMountsFor = lib.mkIf (lib.hasPrefix "/" fs.spec) fs.spec;
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
} }