disko: add monolith config

This commit is contained in:
Leonardo Eugênio 2024-06-13 22:43:42 -03:00
parent 538a7c202e
commit eb85e2573d
3 changed files with 175 additions and 83 deletions

View file

@ -148,6 +148,26 @@
"type": "github" "type": "github"
} }
}, },
"disko": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1718242063,
"narHash": "sha256-n3AWItJ4a94GT0cray/eUV7tt3mulQ52L+lWJN9d1E8=",
"owner": "nix-community",
"repo": "disko",
"rev": "832a9f2c81ff3485404bd63952eadc17bf7ccef2",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "disko",
"type": "github"
}
},
"dzgui-nix": { "dzgui-nix": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@ -565,6 +585,7 @@
"agenix": "agenix", "agenix": "agenix",
"demoji": "demoji", "demoji": "demoji",
"dhist": "dhist", "dhist": "dhist",
"disko": "disko",
"dzgui-nix": "dzgui-nix", "dzgui-nix": "dzgui-nix",
"home-manager": "home-manager", "home-manager": "home-manager",
"nix-index-database": "nix-index-database", "nix-index-database": "nix-index-database",

View file

@ -20,7 +20,10 @@ let
]; ];
in in
{ {
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; imports = [
(modulesPath + "/installer/scan/not-detected.nix")
./partition.nix
];
boot.initrd.availableKernelModules = [ boot.initrd.availableKernelModules = [
"nvme" "nvme"
"xhci_pci" "xhci_pci"
@ -43,8 +46,8 @@ in
"amdgpu.dcdebugmask=0x10" # amdgpu undervolting bug "amdgpu.dcdebugmask=0x10" # amdgpu undervolting bug
"video=DP-1:1920x1080@144" "video=DP-1:1920x1080@144"
# hibernation # hibernation
"resume=LABEL=BTRFS_ROOT" # findmnt -o LABEL --noheadings /swap/ # "resume=LABEL=BTRFS_ROOT" # findmnt -o LABEL --noheadings /swap/
"resume_offset=36709632" # btrfs inspect-internal map-swapfile -r /swap/swapfile # "resume_offset=36709632" # btrfs inspect-internal map-swapfile -r /swap/swapfile
]; ];
systemd.sleep.extraConfig = '' systemd.sleep.extraConfig = ''
HibernateDelaySec=30s HibernateDelaySec=30s
@ -74,73 +77,73 @@ in
}; };
}; };
fileSystems."/" = { # fileSystems."/" = {
device = "/dev/disk/by-label/BTRFS_ROOT"; # device = "/dev/disk/by-label/BTRFS_ROOT";
fsType = "btrfs"; # fsType = "btrfs";
options = [ "subvol=nixos" ] ++ btrfs_options ++ btrfs_ssd; # options = [ "subvol=nixos" ] ++ btrfs_options ++ btrfs_ssd;
}; # };
# boot.initrd.luks.reusePassphrases = true; # # boot.initrd.luks.reusePassphrases = true;
boot.initrd.luks.devices = { # boot.initrd.luks.devices = {
"main" = { # "main" = {
bypassWorkqueues = true; # bypassWorkqueues = true;
device = "/dev/disk/by-label/CRYPT_ROOT"; # device = "/dev/disk/by-label/CRYPT_ROOT";
}; # };
"data" = { # "data" = {
bypassWorkqueues = true; # bypassWorkqueues = true;
device = "/dev/disk/by-label/CRYPT_DATA"; # device = "/dev/disk/by-label/CRYPT_DATA";
}; # };
"bigboy" = { # "bigboy" = {
bypassWorkqueues = true; # bypassWorkqueues = true;
device = "/dev/disk/by-label/CRYPT_BIGBOY"; # device = "/dev/disk/by-label/CRYPT_BIGBOY";
}; # };
}; # };
boot.loader.efi.efiSysMountPoint = "/boot/efi"; # boot.loader.efi.efiSysMountPoint = "/boot/efi";
fileSystems."/boot/efi" = { # fileSystems."/boot/efi" = {
device = "/dev/disk/by-label/NIXBOOT"; # device = "/dev/disk/by-label/NIXBOOT";
fsType = "vfat"; # fsType = "vfat";
}; # };
fileSystems."/home" = { # fileSystems."/home" = {
device = "/dev/disk/by-label/BTRFS_ROOT"; # device = "/dev/disk/by-label/BTRFS_ROOT";
fsType = "btrfs"; # fsType = "btrfs";
options = [ "subvol=home" ] ++ btrfs_options ++ btrfs_ssd; # options = [ "subvol=home" ] ++ btrfs_options ++ btrfs_ssd;
}; # };
fileSystems."/home/lelgenio/Games" = { # fileSystems."/home/lelgenio/Games" = {
device = "/dev/disk/by-label/BTRFS_DATA"; # device = "/dev/disk/by-label/BTRFS_DATA";
fsType = "btrfs"; # fsType = "btrfs";
options = [ # options = [
"subvol=@games" # "subvol=@games"
"nofail" # "nofail"
] ++ btrfs_options; # ] ++ btrfs_options;
}; # };
fileSystems."/home/lelgenio/Downloads/Torrents" = { # fileSystems."/home/lelgenio/Downloads/Torrents" = {
device = "/dev/disk/by-label/BTRFS_DATA"; # device = "/dev/disk/by-label/BTRFS_DATA";
fsType = "btrfs"; # fsType = "btrfs";
options = [ # options = [
"subvol=@torrents" # "subvol=@torrents"
"nofail" # "nofail"
] ++ btrfs_options; # ] ++ btrfs_options;
}; # };
fileSystems."/home/lelgenio/Música" = { # fileSystems."/home/lelgenio/Música" = {
device = "/dev/disk/by-label/BTRFS_DATA"; # device = "/dev/disk/by-label/BTRFS_DATA";
fsType = "btrfs"; # fsType = "btrfs";
options = [ # options = [
"subvol=@music" # "subvol=@music"
"nofail" # "nofail"
] ++ btrfs_options; # ] ++ btrfs_options;
}; # };
fileSystems."/home/lelgenio/.local/mount/data" = { # fileSystems."/home/lelgenio/.local/mount/data" = {
device = "/dev/disk/by-label/BTRFS_DATA"; # device = "/dev/disk/by-label/BTRFS_DATA";
fsType = "btrfs"; # fsType = "btrfs";
options = [ # options = [
"subvol=@data" # "subvol=@data"
"nofail" # "nofail"
] ++ btrfs_options; # ] ++ btrfs_options;
}; # };
fileSystems."/home/lelgenio/.local/mount/bigboy" = { # fileSystems."/home/lelgenio/.local/mount/bigboy" = {
device = "/dev/disk/by-label/BTRFS_BIGBOY"; # device = "/dev/disk/by-label/BTRFS_BIGBOY";
fsType = "btrfs"; # fsType = "btrfs";
options = [ "nofail" ] ++ btrfs_options ++ btrfs_ssd; # options = [ "nofail" ] ++ btrfs_options ++ btrfs_ssd;
}; # };
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking # Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's # (the default) this is the recommended approach. When using systemd-networkd it's
@ -162,17 +165,17 @@ in
''; '';
# swap # swap
fileSystems."/swap" = { # fileSystems."/swap" = {
device = "/dev/disk/by-label/BTRFS_ROOT"; # device = "/dev/disk/by-label/BTRFS_ROOT";
fsType = "btrfs"; # fsType = "btrfs";
# Note these options effect the entire BTRFS filesystem and not just this volume, # # Note these options effect the entire BTRFS filesystem and not just this volume,
# with the exception of `"subvol=swap"`, the other options are repeated in my other `fileSystem` mounts # # with the exception of `"subvol=swap"`, the other options are repeated in my other `fileSystem` mounts
options = [ "subvol=swap" ] ++ btrfs_options ++ btrfs_ssd; # options = [ "subvol=swap" ] ++ btrfs_options ++ btrfs_ssd;
}; # };
swapDevices = [ # swapDevices = [
{ # {
device = "/swap/swapfile"; # device = "/swap/swapfile";
size = (1024 * 16) + (1024 * 2); # RAM size + 2 GB # size = (1024 * 16) + (1024 * 2); # RAM size + 2 GB
} # }
]; # ];
} }

View file

@ -0,0 +1,68 @@
let
btrfs_options = [
"compress=zstd:3"
"noatime"
"x-systemd.device-timeout=0"
];
btrfs_ssd = btrfs_options ++ [
"ssd"
"discard=async"
];
in
{
disko.devices = {
disk = {
bigboy_disk = {
type = "disk";
device = "/dev/nvme0n1";
content = {
type = "gpt";
partitions = {
ESP = {
size = "2G";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [ "defaults" ];
};
};
luks = {
size = "100%";
content = {
type = "luks";
name = "bigboy";
# 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" ];
subvolumes = {
"/@nixos" = {
mountpoint = "/";
mountOptions = btrfs_ssd;
};
"/@home" = {
mountpoint = "/home";
mountOptions = btrfs_ssd;
};
"/@swap" = {
mountpoint = "/.swapvol";
swap.swapfile.size = "32G";
};
};
};
};
};
};
};
};
};
};
}