Refactored zfs

This commit is contained in:
James Patrick 2021-12-15 00:12:00 -05:00
parent ffc2762249
commit ab33edcb6b
5 changed files with 32 additions and 43 deletions

View File

@ -5,11 +5,12 @@
{ {
imports = [ imports = [
../modules/zfs.nix
../modules/profiles/laptop.nix ../modules/profiles/laptop.nix
(modulesPath + "/installer/scan/not-detected.nix") (modulesPath + "/installer/scan/not-detected.nix")
]; ];
this.systems.zfs.enable = true;
# This is required for the zfs module as well. Must be unique. Run the following head -c4 /dev/urandom | od -A none -t x4 # This is required for the zfs module as well. Must be unique. Run the following head -c4 /dev/urandom | od -A none -t x4
networking.hostId = "a7a1c3f5"; networking.hostId = "a7a1c3f5";
networking.hostName = "nil"; # Define your hostname. networking.hostName = "nil"; # Define your hostname.

View File

@ -15,6 +15,5 @@
# TODO Refactor everything after this. # TODO Refactor everything after this.
./cli.nix ./cli.nix
./fonts.nix ./fonts.nix
./zfs.nix
]; ];
} }

View File

@ -1,3 +1,3 @@
{ config, pkgs, ... }: { { config, pkgs, ... }: {
imports = [ ./gtk.nix ./boot.nix ./xdg.nix ./flatpak.nix ]; imports = [ ./gtk.nix ./boot.nix ./xdg.nix ./flatpak.nix ./zfs.nix ];
} }

View File

@ -1,22 +1,33 @@
{ config, pkgs, ... }: { { config, lib, pkgs, ... }:
boot = { let cfg = config.this.systems.zfs;
supportedFilesystems = [ "zfs" ]; in with lib; {
zfs = { options.this.systems.zfs = {
forceImportRoot = false; enable = mkOption {
forceImportAll = false; default = false;
}; type = with types; bool;
# this was required for the initial setup of the zpool. description = "enable zfs";
# see https://nixos.org/nixos/options.html#boot.zfs.forceimportroot
# kernelParams = ["zfs_force=1"];
};
services.zfs = {
autoScrub.enable = true;
# enable default auto-snapshots
autoSnapshot = {
enable = true;
flags = "-k -p --utc";
}; };
}; };
config = mkIf cfg.enable {
boot = {
supportedFilesystems = [ "zfs" ];
zfs = {
forceImportRoot = false;
forceImportAll = false;
};
# this was required for the initial setup of the zpool.
# see https://nixos.org/nixos/options.html#boot.zfs.forceimportroot
# kernelParams = ["zfs_force=1"];
};
services.zfs = {
autoScrub.enable = true;
# enable default auto-snapshots
autoSnapshot = {
enable = true;
flags = "-k -p --utc";
};
};
};
} }

View File

@ -1,22 +0,0 @@
{ config, pkgs, ... }: {
boot = {
supportedFilesystems = [ "zfs" ];
zfs = {
forceImportRoot = false;
forceImportAll = false;
};
# this was required for the initial setup of the zpool.
# see https://nixos.org/nixos/options.html#boot.zfs.forceimportroot
# kernelParams = ["zfs_force=1"];
};
services.zfs = {
autoScrub.enable = true;
# enable default auto-snapshots
autoSnapshot = {
enable = true;
flags = "-k -p --utc";
};
};
}