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 = [
../modules/zfs.nix
../modules/profiles/laptop.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
networking.hostId = "a7a1c3f5";
networking.hostName = "nil"; # Define your hostname.

View File

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

View File

@ -1,3 +1,3 @@
{ 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, ... }: {
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";
{ config, lib, pkgs, ... }:
let cfg = config.this.systems.zfs;
in with lib; {
options.this.systems.zfs = {
enable = mkOption {
default = false;
type = with types; bool;
description = "enable zfs";
};
};
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";
};
};
}