From 9a40ac45f0e572a41f2f8f3d2f18c50338c9ddb2 Mon Sep 17 00:00:00 2001 From: Tim Keller Date: Sat, 11 Apr 2026 18:33:20 -0500 Subject: btrfs profile with autoscrubbing and move docker.storageDriver to the btrfs/zfs profiles --- archetypes/collections/development/docker.nix | 11 +---------- archetypes/default.nix | 1 + archetypes/profiles/btrfs/default.nix | 17 +++++++++++++++++ archetypes/profiles/zfs/default.nix | 4 +++- hosts/T495/configuration.nix | 11 ++++++----- hosts/X230/configuration.nix | 11 ++++++----- hosts/flex-wg-router/configuration.nix | 11 +++++++---- hosts/hp-envy-office/configuration.nix | 11 ++++++----- hosts/libreX60/configuration.nix | 10 ++++++---- hosts/optiplex/configuration.nix | 11 ++++++----- hosts/poweredge/configuration.nix | 2 -- 11 files changed, 59 insertions(+), 41 deletions(-) create mode 100644 archetypes/profiles/btrfs/default.nix diff --git a/archetypes/collections/development/docker.nix b/archetypes/collections/development/docker.nix index 0e09744..0c9fce4 100644 --- a/archetypes/collections/development/docker.nix +++ b/archetypes/collections/development/docker.nix @@ -3,19 +3,10 @@ in { options._archetypes.collections.development.docker = { enable = lib.mkEnableOption "enables docker"; - # TODO move to btrfs profile - btrfsSupport = lib.mkOption { - type = lib.types.bool; - default = true; - description = "Changes docker storageDriver to btrfs."; - }; }; config = lib.mkIf cfg.enable { - virtualisation.docker = { - enable = true; - storageDriver = lib.mkIf cfg.btrfsSupport "btrfs"; - }; + virtualisation.docker.enable = true; environment.systemPackages = with pkgs; [ docker-compose diff --git a/archetypes/default.nix b/archetypes/default.nix index 5e47bc9..3884a49 100644 --- a/archetypes/default.nix +++ b/archetypes/default.nix @@ -8,6 +8,7 @@ ./collections/utilities.nix ./collections/virtualization.nix + ./profiles/btrfs ./profiles/desktop ./profiles/headless ./profiles/pi diff --git a/archetypes/profiles/btrfs/default.nix b/archetypes/profiles/btrfs/default.nix new file mode 100644 index 0000000..88fad38 --- /dev/null +++ b/archetypes/profiles/btrfs/default.nix @@ -0,0 +1,17 @@ +{ lib, pkgs, ... }: let + mkBtrfs = lib.mkOverride 820; + + # https://wiki.nixos.org/wiki/Btrfs + nixosConfig = { + services.btrfs = { + autoScrub.enable = mkBtrfs true; + }; + + # Make docker work with btrfs + virtualisation.docker.storageDriver = mkBtrfs "btrfs"; + }; + + homeConfig = {}; +in { + imports = [ (lib._mkProfileArchetype "btrfs" nixosConfig homeConfig) ]; +} diff --git a/archetypes/profiles/zfs/default.nix b/archetypes/profiles/zfs/default.nix index 5fe63fe..a3ca2e1 100644 --- a/archetypes/profiles/zfs/default.nix +++ b/archetypes/profiles/zfs/default.nix @@ -13,10 +13,12 @@ autoSnapshot.enable = mkZfs true; autoScrub.enable = mkZfs true; }; + + # Make docker work with zfs + virtualisation.docker.storageDriver = mkZfs "zfs"; }; homeConfig = {}; in { imports = [ (lib._mkProfileArchetype "zfs" nixosConfig homeConfig) ]; } - diff --git a/hosts/T495/configuration.nix b/hosts/T495/configuration.nix index eb24cba..b80f27e 100644 --- a/hosts/T495/configuration.nix +++ b/hosts/T495/configuration.nix @@ -6,12 +6,13 @@ # Enable common options _archetypes = { - # Use desktop profile - profiles.desktop = { - enable = true; - home.users.timmy.enable = true; + profiles = { + desktop = { + enable = true; + home.users.timmy.enable = true; + }; + btrfs.enable = true; }; - # Install software collections = { desktop = { extraUtilities.enable = true; diff --git a/hosts/X230/configuration.nix b/hosts/X230/configuration.nix index fcf0b05..22856f2 100644 --- a/hosts/X230/configuration.nix +++ b/hosts/X230/configuration.nix @@ -6,12 +6,13 @@ # Enable common options _archetypes = { - # Use desktop profile - profiles.desktop = { - enable = true; - home.users.timmy.enable = true; + profiles = { + desktop = { + enable = true; + home.users.timmy.enable = true; + }; + btrfs.enable = true; }; - # Install software collections = { desktop = { crypto.enable = true; diff --git a/hosts/flex-wg-router/configuration.nix b/hosts/flex-wg-router/configuration.nix index 18d9667..dd0ca95 100644 --- a/hosts/flex-wg-router/configuration.nix +++ b/hosts/flex-wg-router/configuration.nix @@ -8,11 +8,14 @@ in { # Enable common options _archetypes = { - profiles.headless = { - enable = true; - home.users.timmy.enable = true; + profiles = { + headless = { + enable = true; + home.users.timmy.enable = true; + }; + router.enable = true; + btrfs.enable = true; }; - profiles.router.enable = true; }; networking = { diff --git a/hosts/hp-envy-office/configuration.nix b/hosts/hp-envy-office/configuration.nix index c55c07b..5e3a463 100644 --- a/hosts/hp-envy-office/configuration.nix +++ b/hosts/hp-envy-office/configuration.nix @@ -7,12 +7,13 @@ # Enable common options _archetypes = { - # Use desktop profile - profiles.desktop = { - enable = true; - home.users.timmy.enable = true; + profiles = { + desktop = { + enable = true; + home.users.timmy.enable = true; + }; + btrfs.enable = true; }; - # Install software collections = { desktop = { extraUtilities.enable = true; diff --git a/hosts/libreX60/configuration.nix b/hosts/libreX60/configuration.nix index 2ebb333..74b7012 100644 --- a/hosts/libreX60/configuration.nix +++ b/hosts/libreX60/configuration.nix @@ -18,10 +18,12 @@ # Enable common options _archetypes = { - # Use desktop profile - profiles.desktop = { - enable = true; - home.users.timmy.enable = true; + profiles = { + desktop = { + enable = true; + home.users.timmy.enable = true; + }; + btrfs.enable = true; }; }; diff --git a/hosts/optiplex/configuration.nix b/hosts/optiplex/configuration.nix index b314905..9dc718b 100644 --- a/hosts/optiplex/configuration.nix +++ b/hosts/optiplex/configuration.nix @@ -8,12 +8,13 @@ # Enable common options _archetypes = { - # Use desktop profile - profiles.desktop = { - enable = true; - home.users.timmy.enable = true; + profiles = { + desktop = { + enable = true; + home.users.timmy.enable = true; + }; + btrfs.enable = true; }; - # Install software collections = { desktop = { extraUtilities.enable = true; diff --git a/hosts/poweredge/configuration.nix b/hosts/poweredge/configuration.nix index 3490589..e2798bd 100644 --- a/hosts/poweredge/configuration.nix +++ b/hosts/poweredge/configuration.nix @@ -22,11 +22,9 @@ }; collections = { development.docker.enable = true; - development.docker.btrfsSupport = false; # TODO remove }; }; - virtualisation.docker.storageDriver = "zfs"; # TODO move to profile # Enable smartd services.smartd.enable = true; # TODO move to archetype -- cgit v1.2.3