diff options
-rw-r--r-- | ops/modules/btrfs-auto-scrub.nix | 25 | ||||
-rw-r--r-- | users/sterni/machines/edwin/default.nix | 2 | ||||
-rw-r--r-- | users/sterni/machines/ingeborg/default.nix | 2 | ||||
-rw-r--r-- | users/sterni/modules/disk-checkup.nix | 25 |
4 files changed, 28 insertions, 26 deletions
diff --git a/ops/modules/btrfs-auto-scrub.nix b/ops/modules/btrfs-auto-scrub.nix new file mode 100644 index 000000000000..b073efa3dfd1 --- /dev/null +++ b/ops/modules/btrfs-auto-scrub.nix @@ -0,0 +1,25 @@ +# Automatically performs a scrub on all btrfs filesystems configured in +# `config.fileSystems` on a daily schedule (by default). Activated by importing. +{ config, lib, ... }: + +{ + config = { + services = { + btrfs.autoScrub = { + enable = true; + interval = lib.mkDefault "daily"; + # gather all btrfs fileSystems, extra ones can be added via the NixOS + # module merging mechanism, of course. + fileSystems = lib.concatLists ( + lib.mapAttrsToList + ( + _: + { fsType, mountPoint, ... }: + if fsType == "btrfs" then [ mountPoint ] else [ ] + ) + config.fileSystems + ); + }; + }; + }; +} diff --git a/users/sterni/machines/edwin/default.nix b/users/sterni/machines/edwin/default.nix index 0204cc463ea1..16951d04f951 100644 --- a/users/sterni/machines/edwin/default.nix +++ b/users/sterni/machines/edwin/default.nix @@ -10,7 +10,7 @@ ./hardware.nix ./network.nix # These modules configure services, websites etc. - ../../modules/disk-checkup.nix + (depot.path.origSrc + "/ops/modules/btrfs-auto-scrub.nix") ./minecraft.nix ./gopher.nix ./http/sterni.lv.nix diff --git a/users/sterni/machines/ingeborg/default.nix b/users/sterni/machines/ingeborg/default.nix index 3012e5f4af9e..8c512eac3bcc 100644 --- a/users/sterni/machines/ingeborg/default.nix +++ b/users/sterni/machines/ingeborg/default.nix @@ -7,6 +7,8 @@ # These modules touch things related to booting (filesystems, initrd network…) ./hardware.nix ./network.nix + # (More or less) pluggable service configuration + (depot.path.origSrc + "/ops/modules/btrfs-auto-scrub.nix") ]; config = { diff --git a/users/sterni/modules/disk-checkup.nix b/users/sterni/modules/disk-checkup.nix deleted file mode 100644 index 8acc08759b17..000000000000 --- a/users/sterni/modules/disk-checkup.nix +++ /dev/null @@ -1,25 +0,0 @@ -# TODO(sterni): configure smartd and alerts -{ config, lib, ... }: - -{ - config = { - services = { - btrfs.autoScrub = { - enable = true; - interval = "daily"; - # gather all btrfs fileSystems and overwrite default - fileSystems = lib.mkForce ( - lib.concatLists ( - lib.mapAttrsToList - ( - _: - { fsType, mountPoint, ... }: - if fsType == "btrfs" then [ mountPoint ] else [ ] - ) - config.fileSystems - ) - ); - }; - }; - }; -} |