Restructure flake.nix for a simpler config for building different images off the same NixOS config.
This commit is contained in:
@@ -29,26 +29,40 @@ in
|
||||
{
|
||||
imports = [ ];
|
||||
|
||||
boot.zfs.devNodes = "/dev/disk/by-partuuid";
|
||||
|
||||
services.zfs = {
|
||||
autoScrub = {
|
||||
enable = true;
|
||||
interval = "monthly";
|
||||
options.me = {
|
||||
zfs.enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
example = true;
|
||||
description = "Whether we want to install zfs.";
|
||||
};
|
||||
trim.enable = true;
|
||||
};
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
zfs_clone_send
|
||||
zfs_clone_recv
|
||||
zfs_clone_resume
|
||||
];
|
||||
config = lib.mkIf config.me.zfs.enable {
|
||||
# Technically only needed when building the ISO because nix detects ZFS in the filesystem list normally. I basically always want this so I'm just setting it to always be on.
|
||||
boot.supportedFilesystems.zfs = true;
|
||||
|
||||
environment.persistence."/persist" = lib.mkIf (!config.me.buildingIso) {
|
||||
hideMounts = true;
|
||||
directories = [
|
||||
"/etc/zfs/zpool.cache" # Which zpools to import, the root zpool is already imported and does not need this cache file but this captures additional pools.
|
||||
boot.zfs.devNodes = "/dev/disk/by-partuuid";
|
||||
|
||||
services.zfs = {
|
||||
autoScrub = {
|
||||
enable = true;
|
||||
interval = "monthly";
|
||||
};
|
||||
trim.enable = true;
|
||||
};
|
||||
|
||||
environment.systemPackages = [
|
||||
zfs_clone_send
|
||||
zfs_clone_recv
|
||||
zfs_clone_resume
|
||||
];
|
||||
|
||||
environment.persistence."/persist" = lib.mkIf (config.me.mountPersistence) {
|
||||
hideMounts = true;
|
||||
directories = [
|
||||
"/etc/zfs/zpool.cache" # Which zpools to import, the root zpool is already imported and does not need this cache file but this captures additional pools.
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user