From dccbf62a1343fc0f02a3d24871dc574a8c423ea4 Mon Sep 17 00:00:00 2001 From: isabel Date: Thu, 30 Apr 2026 15:39:03 +0000 Subject: [PATCH] nixos/hardware/fs: simplify --- modules/nixos/hardware/fs.nix | 35 +++++++++++++---------------------- 1 file(s) changed, 13 insertion(s)(+), 22 deletion(s)(-) diff --git a/modules/nixos/hardware/fs.nix b/modules/nixos/hardware/fs.nix --- a/modules/nixos/hardware/fs.nix +++ b/modules/nixos/hardware/fs.nix @@ -1,26 +1,17 @@ -{ lib, config, ... }: -let - inherit (lib) mkIf mkMerge filterAttrs; - - hasBtrfs = (filterAttrs (_: v: v.fsType == "btrfs") config.fileSystems) != { }; -in +{ config, ... }: { - config = mkMerge [ - { - # discard blocks that are not in use by the filesystem, good for SSDs health - services.fstrim = { - enable = true; - interval = "weekly"; - }; - } + # discard blocks that are not in use by the filesystem, good for SSDs health + services = { + fstrim = { + enable = true; + interval = "weekly"; + }; # clean btrfs devices - (mkIf hasBtrfs { - services.btrfs.autoScrub = { - enable = true; - interval = "weekly"; - fileSystems = [ "/" ]; - }; - }) - ]; + btrfs.autoScrub = { + enable = config.boot.supportedFilesystems.btrfs or false; + interval = "weekly"; + fileSystems = [ "/" ]; + }; + }; } -- tangled.sh