modules/nixos: add disko-zfs

This commit is contained in:
zowoq 2024-04-07 08:14:55 +10:00
parent cc39102f92
commit f25792b910
2 changed files with 90 additions and 0 deletions

View file

@ -161,6 +161,7 @@
builder = ./modules/nixos/builder.nix;
community-builder = ./modules/nixos/community-builder;
disko-raid = ./modules/nixos/disko-raid.nix;
disko-zfs = ./modules/nixos/disko-zfs.nix;
github-org-backup = ./modules/nixos/github-org-backup.nix;
hercules-ci = ./modules/nixos/hercules-ci;
hydra = ./modules/nixos/hydra.nix;

View file

@ -0,0 +1,89 @@
{ inputs, ... }:
{
imports = [
inputs.disko.nixosModules.disko
];
networking.hostId = "deadbeef";
# this is both efi and bios compatible
boot.loader.grub = {
enable = true;
efiSupport = true;
efiInstallAsRemovable = true;
};
disko.devices = {
disk = {
nvme0n1 = {
type = "disk";
device = "/dev/nvme0n1";
content = {
type = "gpt";
partitions = {
boot = {
size = "1M";
type = "EF02"; # for grub MBR
};
ESP = {
size = "1G";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [ "nofail" ];
};
};
zfs = {
size = "100%";
content = {
type = "zfs";
pool = "zroot";
};
};
};
};
};
nvme1n1 = {
type = "disk";
device = "/dev/nvme1n1";
content = {
type = "gpt";
partitions = {
zfs = {
size = "100%";
content = {
type = "zfs";
pool = "zroot";
};
};
};
};
};
};
zpool = {
zroot = {
type = "zpool";
options = {
ashift = "12";
};
rootFsOptions = {
acltype = "posixacl";
atime = "off";
compression = "lz4";
mountpoint = "none";
xattr = "sa";
"com.sun:auto-snapshot" = "false";
};
datasets = {
root = {
type = "zfs_fs";
mountpoint = "/";
options.mountpoint = "legacy";
};
};
};
};
};
}