system: Move ZFS stuff to own system module

Signed-off-by: Christoph Heiss <christoph@c8h4.io>
This commit is contained in:
Christoph Heiss 2023-11-10 22:03:12 +01:00
parent 0a742a728e
commit 3302058f35
Signed by: c8h4
GPG key ID: 73D5E7FDEE3DE49A
2 changed files with 14 additions and 7 deletions

View file

@ -1,10 +1,11 @@
{ config, pkgs, ... }: { pkgs, ... }:
{ {
imports = [ imports = [
../secrets/machines/back.nix ../secrets/machines/back.nix
../system/baremetal-server.nix ../system/baremetal-server.nix
../system/ucode-intel.nix ../system/ucode-intel.nix
../system/zfs.nix
]; ];
system.stateVersion = "23.11"; system.stateVersion = "23.11";
@ -46,8 +47,6 @@
''; '';
}; };
boot.kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages;
fileSystems."/" = { fileSystems."/" = {
device = "/dev/mapper/nixos-root"; device = "/dev/mapper/nixos-root";
fsType = "btrfs"; fsType = "btrfs";
@ -76,8 +75,4 @@
device = "/dev/md0"; device = "/dev/md0";
fsType = "vfat"; fsType = "vfat";
}; };
services.zfs.autoScrub.enable = true;
services.zfs.autoSnapshot.enable = true;
services.zfs.trim.enable = true;
} }

12
system/zfs.nix Normal file
View file

@ -0,0 +1,12 @@
{ config, pkgs, ... }:
{
boot.kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages;
boot.supportedFilesystems = [ "boot" ];
environment.systemPackages = with pkgs; [ zfs ];
services.zfs.autoScrub.enable = true;
services.zfs.autoSnapshot.enable = true;
services.zfs.trim.enable = true;
}