disko/types/zfs.nix

48 lines
1.2 KiB
Nix
Raw Normal View History

2023-01-28 15:19:13 +00:00
{ config, options, lib, diskoLib, ... }:
{
options = {
type = lib.mkOption {
type = lib.types.enum [ "zfs" ];
internal = true;
description = "Type";
};
pool = lib.mkOption {
type = lib.types.str;
description = "Name of the ZFS pool";
};
_meta = lib.mkOption {
internal = true;
readOnly = true;
type = lib.types.functionTo diskoLib.jsonType;
default = dev: {
deviceDependencies.zpool.${config.pool} = [ dev ];
};
description = "Metadata";
};
_create = diskoLib.mkCreateOption {
inherit config options;
default = { dev }: ''
2023-02-14 07:35:12 +00:00
echo "${dev}" >> "$disko_devices_dir"/zfs_${config.pool}
2023-01-28 15:19:13 +00:00
'';
};
_mount = diskoLib.mkMountOption {
inherit config options;
default = { dev }:
{ };
};
_config = lib.mkOption {
internal = true;
readOnly = true;
default = dev: [ ];
description = "NixOS configuration";
};
_pkgs = lib.mkOption {
internal = true;
readOnly = true;
type = lib.types.functionTo (lib.types.listOf lib.types.package);
default = pkgs: [ pkgs.zfs ];
description = "Packages";
};
};
}