90 lines
2.6 KiB
Nix
90 lines
2.6 KiB
Nix
# sudo nix --experimental-features "nix-command flakes" run github:nix-community/disko -- --mode disko /tmp/disko.nix
|
|
# nixos-generate-config --no-filesystems --root /mnt
|
|
# mv /tmp/disko.nix /mnt/etc/nixos
|
|
# REMOVE: https://www.youtube.com/watch?v=nLwbNhSxLd4 (Full NixOS Guide)
|
|
# REMOVE: https://www.youtube.com/watch?v=YPKwkWtK7l0
|
|
# IMPORTANT: this disk configuration is setup for *impermanance* systems.
|
|
# to get rid of impermanance support, simply remove the "/persist" btrfs subvolume.
|
|
# to import, add this to the imports list:
|
|
# (import ./disko.nix { device = "/dev/?" })
|
|
{device ? throw "Set this to your disk device, e.g. /dev/disk/by-id/...", ...}: {
|
|
disko.devices = {
|
|
disk = {
|
|
main = {
|
|
inherit device;
|
|
type = "disk";
|
|
content = {
|
|
type = "gpt";
|
|
partitions = {
|
|
boot = {
|
|
name = "boot";
|
|
size = "1M";
|
|
type = "EF02";
|
|
};
|
|
ESP = {
|
|
name = "ESP";
|
|
size = "500M";
|
|
type = "EF00";
|
|
content = {
|
|
type = "filesystem";
|
|
format = "vfat";
|
|
mountpoint = "/boot";
|
|
};
|
|
};
|
|
luks = {
|
|
size = "100%";
|
|
content = {
|
|
type = "luks";
|
|
name = "crypted";
|
|
passwordFile = "/tmp/secret.key";
|
|
settings = {
|
|
allowDiscards = true;
|
|
};
|
|
content = {
|
|
type = "lvm_pv";
|
|
vg = "root_vg";
|
|
};
|
|
};
|
|
};
|
|
swap = {
|
|
size = "35G";
|
|
content = {
|
|
type = "swap";
|
|
resumeDevice = true;
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
lvm_vg = {
|
|
root_vg = {
|
|
type = "lvm_vg";
|
|
lvs = {
|
|
root = {
|
|
size = "100%FREE";
|
|
content = {
|
|
type = "btrfs";
|
|
extraArgs = ["-f"];
|
|
subvolumes = {
|
|
"/root" = {
|
|
mountpoint = "/";
|
|
mountOptions = ["compress=zstd" "noatime"];
|
|
};
|
|
"/home" = {
|
|
mountpoint = "/home";
|
|
mountOptions = ["compress=zstd" "noatime"];
|
|
};
|
|
"/nix" = {
|
|
mountpoint = "/nix";
|
|
mountOptions = ["compress=zstd" "noatime"];
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
}
|
|
|