Add untested disko config
nix run github:nix-community/disko -- -m create --dry-run ./disko-config.nix
This commit is contained in:
parent
911a3367ca
commit
f9fd5b52a9
114
disko-config.nix
Normal file
114
disko-config.nix
Normal file
|
@ -0,0 +1,114 @@
|
||||||
|
{ name ? "chaos", disk ? "sda1", ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
disk = {
|
||||||
|
${disk} = {
|
||||||
|
device = "/dev/${disk}";
|
||||||
|
type = "disk";
|
||||||
|
content = {
|
||||||
|
type = "table";
|
||||||
|
format = "gpt";
|
||||||
|
partitions = [
|
||||||
|
{
|
||||||
|
type = "partition";
|
||||||
|
name = "ESP";
|
||||||
|
start = "1MiB";
|
||||||
|
end = "512MiB";
|
||||||
|
bootable = true;
|
||||||
|
content = {
|
||||||
|
type = "filesystem";
|
||||||
|
format = "vfat";
|
||||||
|
mountpoint = "/boot";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
{
|
||||||
|
type = "partition";
|
||||||
|
name = "root";
|
||||||
|
start = "512MiB";
|
||||||
|
end = "100%";
|
||||||
|
part-type = "primary";
|
||||||
|
content = {
|
||||||
|
type = "luks";
|
||||||
|
# mountpoint = "/";
|
||||||
|
name = "crypt-${name}";
|
||||||
|
content = {
|
||||||
|
type = "lvm_pv";
|
||||||
|
vg = "lvm-${name}";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
lvm_vg.pool = {
|
||||||
|
type = "lvm_vg";
|
||||||
|
lvs = {
|
||||||
|
zfs = {
|
||||||
|
type = "lvm_lv";
|
||||||
|
size = "200GiB";
|
||||||
|
content = {
|
||||||
|
type = "zfs";
|
||||||
|
pool = name;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
raw = {
|
||||||
|
type = "lvm_lv";
|
||||||
|
size = "100%-200GiB";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
zpool."${name}-${disk}" = {
|
||||||
|
type = "zpool";
|
||||||
|
rootFsOptions = {
|
||||||
|
acltype = "posixacl";
|
||||||
|
ashift = "12";
|
||||||
|
autotrim = "on";
|
||||||
|
canmount = "off";
|
||||||
|
compression = "zstd";
|
||||||
|
normalization = "formD";
|
||||||
|
mountpoint = "none";
|
||||||
|
xattr = "sa";
|
||||||
|
};
|
||||||
|
datasets = let
|
||||||
|
dataset = mountpoint: {
|
||||||
|
options = {
|
||||||
|
canmount = "on";
|
||||||
|
inherit mountpoint;
|
||||||
|
};
|
||||||
|
zfs_type = "filesystem";
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
"data" = dataset "/";
|
||||||
|
"data/etc" = dataset "/etc";
|
||||||
|
"data/home" = dataset "/home";
|
||||||
|
"data/var" = dataset "/var";
|
||||||
|
"data/var/backup" = dataset "/var/backup";
|
||||||
|
"data/var/lib" = dataset "/var/lib";
|
||||||
|
"data/var/log" = dataset "/var/log";
|
||||||
|
"nixos" = {
|
||||||
|
options.canmount = "off";
|
||||||
|
zfs_type = "filesystem";
|
||||||
|
};
|
||||||
|
"nixos/nix" = dataset "/nix";
|
||||||
|
"nixos/nix/store" = {
|
||||||
|
options = {
|
||||||
|
atime = "off";
|
||||||
|
canmount = "on";
|
||||||
|
mountpoint = "/nix/store";
|
||||||
|
};
|
||||||
|
zfs_type = "filesystem";
|
||||||
|
};
|
||||||
|
"nixos/nix/var" = dataset "/nix/var";
|
||||||
|
"resered" = {
|
||||||
|
options = {
|
||||||
|
canmount = "off";
|
||||||
|
reservation = "5GiB";
|
||||||
|
};
|
||||||
|
zfs_type = "filesystem";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user