97 lines
4.4 KiB
Nix
97 lines
4.4 KiB
Nix
# NOTE: ... is needed because dikso passes diskoFile
|
|
{
|
|
lib,
|
|
disk ? [ "/dev/vda" ],
|
|
withSwap ? false,
|
|
swapSize,
|
|
configVars,
|
|
...
|
|
}:
|
|
{
|
|
disko.devices = {
|
|
disk = {
|
|
disk0 = {
|
|
type = "disk";
|
|
device = "/dev/disk/by-uuid/0A48C597-F95A-4187-BF57-83B45AE41327";
|
|
content = {
|
|
type = "gpt";
|
|
partitions = {
|
|
ESP = {
|
|
# name = "ESP";
|
|
priority = 1;
|
|
start = "1M";
|
|
end = "512M";
|
|
type = "EF00";
|
|
content = {
|
|
type = "filesystem";
|
|
format = "vfat";
|
|
mountpoint = "/boot";
|
|
mountOptions = [ "defaults" ];
|
|
};
|
|
};
|
|
luks = {
|
|
# name = "root";
|
|
size = "100%";
|
|
content = {
|
|
type = "luks";
|
|
name = "crypted";
|
|
# disable settings.keyFile if you want to use interactive password entry
|
|
#passwordFile = "/tmp/secret.key"; # Interactive
|
|
settings = {
|
|
allowDiscards = true;
|
|
keyFile = "/tmp/secret.key";
|
|
};
|
|
additionalKeyFiles = [ "/tmp/additionalSecret.key" ];
|
|
content = {
|
|
type = "btrfs";
|
|
extraArgs = [ "-f" ]; # Override existing partition
|
|
# Subvolumes must set a mountpoint in order to be mounted,
|
|
# unless their parent is mounted
|
|
subvolumes = {
|
|
"@root" = {
|
|
mountpoint = "/";
|
|
mountOptions = [ "compress=zstd" "noatime" ];
|
|
};
|
|
"@home" = {
|
|
mountpoint = "/home";
|
|
mountOptions = [ "compress=zstd" ];
|
|
};
|
|
"@nix" = {
|
|
mountpoint = "/nix";
|
|
mountOptions = [ "compress=zstd" "noatime" ];
|
|
};
|
|
"@persist" = {
|
|
mountpoint = "${configVars.persistFolder}";
|
|
mountOptions = [
|
|
"compress=zstd"
|
|
"noatime"
|
|
];
|
|
};
|
|
"@var-lib" = {
|
|
mountpoint = "/var/lib";
|
|
mountOptions = [ "compress=zstd" "noatime" ];
|
|
};
|
|
"@var-log" = {
|
|
mountpoint = "/var/log";
|
|
mountOptions = [ "compress=zstd" "noatime" ];
|
|
};
|
|
"@var-tmp" = {
|
|
mountpoint = "/var/tmp";
|
|
mountOptions = [ "compress=zstd" "noatime" ];
|
|
};
|
|
"@swap" = lib.mkIf withSwap {
|
|
mountpoint = "/.swapvol";
|
|
swap.swapfile.size = "${swapSize}G";
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
}
|
|
|