Merge pull request #80141 from symphorien/scrub

nixos/btrfs: make autoScrub not prevent shutdown or suspend
This commit is contained in:
Léo Gaspard 2020-03-12 22:39:34 +01:00 committed by GitHub
commit 26b1ef1506
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -118,12 +118,17 @@ in
fs' = utils.escapeSystemdPath fs;
in nameValuePair "btrfs-scrub-${fs'}" {
description = "btrfs scrub on ${fs}";
# scrub prevents suspend2ram or proper shutdown
conflicts = [ "shutdown.target" "sleep.target" ];
before = [ "shutdown.target" "sleep.target" ];
serviceConfig = {
Type = "oneshot";
# simple and not oneshot, otherwise ExecStop is not used
Type = "simple";
Nice = 19;
IOSchedulingClass = "idle";
ExecStart = "${pkgs.btrfs-progs}/bin/btrfs scrub start -B ${fs}";
ExecStop = "${pkgs.btrfs-progs}/bin/btrfs scrub cancel ${fs}";
};
};
in listToAttrs (map scrubService cfgScrub.fileSystems);