add zfs module with options

This commit is contained in:
Noah Masur 2023-02-25 11:22:31 -05:00
parent 30fe7c2d18
commit d56a48cf65
3 changed files with 19 additions and 3 deletions

View File

@ -19,6 +19,7 @@ nixpkgs.lib.nixosSystem {
disko.nixosModules.disko disko.nixosModules.disko
{ {
server = true; server = true;
zfs.enable = true;
gui.enable = false; gui.enable = false;
theme = { colors = (import ../../colorscheme/gruvbox).dark; }; theme = { colors = (import ../../colorscheme/gruvbox).dark; };
nixpkgs.overlays = overlays; nixpkgs.overlays = overlays;
@ -36,9 +37,9 @@ nixpkgs.lib.nixosSystem {
neovim.enable = true; neovim.enable = true;
boot.zfs.enabled = true; # boot.zfs.enabled = true;
boot.kernelPackages = # boot.kernelPackages =
config.boot.zfs.package.latestCompatibleLinuxPackages; # config.boot.zfs.package.latestCompatibleLinuxPackages;
# boot.zfs.extraPools = [ "mypool" ]; # boot.zfs.extraPools = [ "mypool" ];
# services.zfs.autoScrub.enable = true; # services.zfs.autoScrub.enable = true;
# services.zfs.autoScrub.interval = "daily"; # services.zfs.autoScrub.interval = "daily";

View File

@ -10,6 +10,7 @@
./server.nix ./server.nix
./sleep.nix ./sleep.nix
./wifi.nix ./wifi.nix
./zfs.nix
]; ];
options = { options = {

View File

@ -0,0 +1,14 @@
{ config, pkgs, lib, ... }: {
options = { zfs.enable = lib.mkEnableOption "ZFS file system."; };
config =
lib.mkIf (pkgs.stdenv.isLinux && config.server && config.zfs.enable) {
# Only use compatible Linux kernel, since ZFS can be behind
boot.kernelPackages =
config.boot.zfs.package.latestCompatibleLinuxPackages;
};
}