From 8df356ad9ce8bc338290158b2756b74ac9ca2346 Mon Sep 17 00:00:00 2001 From: Alejandro Angulo Date: Sat, 25 Mar 2023 10:16:14 -0700 Subject: [PATCH] Added minimal zfs config Still want to add an option for zfs on root later on. --- modules/system/zfs/default.nix | 22 ++++++++++++++++++++++ systems/x86_64-linux/carbon/default.nix | 2 ++ systems/x86_64-linux/carbon/zfs.nix | 5 ----- systems/x86_64-linux/gospel/default.nix | 2 ++ 4 files changed, 26 insertions(+), 5 deletions(-) create mode 100644 modules/system/zfs/default.nix diff --git a/modules/system/zfs/default.nix b/modules/system/zfs/default.nix new file mode 100644 index 0000000..7e85fe4 --- /dev/null +++ b/modules/system/zfs/default.nix @@ -0,0 +1,22 @@ +{ + options, + config, + pkgs, + lib, + ... +}: +with lib; let + cfg = config.aa.system.zfs; +in { + options.aa.system.zfs = with types; { + enable = mkEnableOption "zfs"; + # TODO: Introduce a zfsOnRoot option + }; + + config = mkIf cfg.enable { + services.zfs = { + autoScrub.enable = true; + autoSnapshot.enable = true; + }; + }; +} diff --git a/systems/x86_64-linux/carbon/default.nix b/systems/x86_64-linux/carbon/default.nix index c9be65d..a2825f1 100644 --- a/systems/x86_64-linux/carbon/default.nix +++ b/systems/x86_64-linux/carbon/default.nix @@ -32,6 +32,8 @@ }; hardware.audio.enable = true; + + system.zfs.enable = true; }; networking = { diff --git a/systems/x86_64-linux/carbon/zfs.nix b/systems/x86_64-linux/carbon/zfs.nix index 591d638..429825c 100644 --- a/systems/x86_64-linux/carbon/zfs.nix +++ b/systems/x86_64-linux/carbon/zfs.nix @@ -54,9 +54,4 @@ ]; }; users.users.root.initialHashedPassword = "$6$VOzIHqv12iJGQIFl$NQf1GeiGhtdLfZFmtZl4vab.xvtVvI7.5ty9zbMFI2dpmHoFdc6XnGwTlClVe./CbcrsQjtPpt7NKf0dNttcw."; - - services.zfs = { - autoScrub.enable = true; - autoSnapshot.enable = true; - }; } diff --git a/systems/x86_64-linux/gospel/default.nix b/systems/x86_64-linux/gospel/default.nix index 4ecaed1..f56232b 100644 --- a/systems/x86_64-linux/gospel/default.nix +++ b/systems/x86_64-linux/gospel/default.nix @@ -39,6 +39,8 @@ }; hardware.audio.enable = true; + + system.zfs.enable = true; }; boot.binfmt.emulatedSystems = ["aarch64-linux" "armv6l-linux"];