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"
}
},
"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": {
"inputs": {
"nixpkgs": [
@ -565,6 +585,7 @@
"agenix": "agenix",
"demoji": "demoji",
"dhist": "dhist",
"disko": "disko",
"dzgui-nix": "dzgui-nix",
"home-manager": "home-manager",
"nix-index-database": "nix-index-database",

View file

@ -20,7 +20,10 @@ let
];
in
{
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
./partition.nix
];
boot.initrd.availableKernelModules = [
"nvme"
"xhci_pci"
@ -43,8 +46,8 @@ in
"amdgpu.dcdebugmask=0x10" # amdgpu undervolting bug
"video=DP-1:1920x1080@144"
# hibernation
"resume=LABEL=BTRFS_ROOT" # findmnt -o LABEL --noheadings /swap/
"resume_offset=36709632" # btrfs inspect-internal map-swapfile -r /swap/swapfile
# "resume=LABEL=BTRFS_ROOT" # findmnt -o LABEL --noheadings /swap/
# "resume_offset=36709632" # btrfs inspect-internal map-swapfile -r /swap/swapfile
];
systemd.sleep.extraConfig = ''
HibernateDelaySec=30s
@ -74,73 +77,73 @@ in
};
};
fileSystems."/" = {
device = "/dev/disk/by-label/BTRFS_ROOT";
fsType = "btrfs";
options = [ "subvol=nixos" ] ++ btrfs_options ++ btrfs_ssd;
};
# boot.initrd.luks.reusePassphrases = true;
boot.initrd.luks.devices = {
"main" = {
bypassWorkqueues = true;
device = "/dev/disk/by-label/CRYPT_ROOT";
};
"data" = {
bypassWorkqueues = true;
device = "/dev/disk/by-label/CRYPT_DATA";
};
"bigboy" = {
bypassWorkqueues = true;
device = "/dev/disk/by-label/CRYPT_BIGBOY";
};
};
boot.loader.efi.efiSysMountPoint = "/boot/efi";
fileSystems."/boot/efi" = {
device = "/dev/disk/by-label/NIXBOOT";
fsType = "vfat";
};
fileSystems."/home" = {
device = "/dev/disk/by-label/BTRFS_ROOT";
fsType = "btrfs";
options = [ "subvol=home" ] ++ btrfs_options ++ btrfs_ssd;
};
fileSystems."/home/lelgenio/Games" = {
device = "/dev/disk/by-label/BTRFS_DATA";
fsType = "btrfs";
options = [
"subvol=@games"
"nofail"
] ++ btrfs_options;
};
fileSystems."/home/lelgenio/Downloads/Torrents" = {
device = "/dev/disk/by-label/BTRFS_DATA";
fsType = "btrfs";
options = [
"subvol=@torrents"
"nofail"
] ++ btrfs_options;
};
fileSystems."/home/lelgenio/Música" = {
device = "/dev/disk/by-label/BTRFS_DATA";
fsType = "btrfs";
options = [
"subvol=@music"
"nofail"
] ++ btrfs_options;
};
fileSystems."/home/lelgenio/.local/mount/data" = {
device = "/dev/disk/by-label/BTRFS_DATA";
fsType = "btrfs";
options = [
"subvol=@data"
"nofail"
] ++ btrfs_options;
};
fileSystems."/home/lelgenio/.local/mount/bigboy" = {
device = "/dev/disk/by-label/BTRFS_BIGBOY";
fsType = "btrfs";
options = [ "nofail" ] ++ btrfs_options ++ btrfs_ssd;
};
# fileSystems."/" = {
# device = "/dev/disk/by-label/BTRFS_ROOT";
# fsType = "btrfs";
# options = [ "subvol=nixos" ] ++ btrfs_options ++ btrfs_ssd;
# };
# # boot.initrd.luks.reusePassphrases = true;
# boot.initrd.luks.devices = {
# "main" = {
# bypassWorkqueues = true;
# device = "/dev/disk/by-label/CRYPT_ROOT";
# };
# "data" = {
# bypassWorkqueues = true;
# device = "/dev/disk/by-label/CRYPT_DATA";
# };
# "bigboy" = {
# bypassWorkqueues = true;
# device = "/dev/disk/by-label/CRYPT_BIGBOY";
# };
# };
# boot.loader.efi.efiSysMountPoint = "/boot/efi";
# fileSystems."/boot/efi" = {
# device = "/dev/disk/by-label/NIXBOOT";
# fsType = "vfat";
# };
# fileSystems."/home" = {
# device = "/dev/disk/by-label/BTRFS_ROOT";
# fsType = "btrfs";
# options = [ "subvol=home" ] ++ btrfs_options ++ btrfs_ssd;
# };
# fileSystems."/home/lelgenio/Games" = {
# device = "/dev/disk/by-label/BTRFS_DATA";
# fsType = "btrfs";
# options = [
# "subvol=@games"
# "nofail"
# ] ++ btrfs_options;
# };
# fileSystems."/home/lelgenio/Downloads/Torrents" = {
# device = "/dev/disk/by-label/BTRFS_DATA";
# fsType = "btrfs";
# options = [
# "subvol=@torrents"
# "nofail"
# ] ++ btrfs_options;
# };
# fileSystems."/home/lelgenio/Música" = {
# device = "/dev/disk/by-label/BTRFS_DATA";
# fsType = "btrfs";
# options = [
# "subvol=@music"
# "nofail"
# ] ++ btrfs_options;
# };
# fileSystems."/home/lelgenio/.local/mount/data" = {
# device = "/dev/disk/by-label/BTRFS_DATA";
# fsType = "btrfs";
# options = [
# "subvol=@data"
# "nofail"
# ] ++ btrfs_options;
# };
# fileSystems."/home/lelgenio/.local/mount/bigboy" = {
# device = "/dev/disk/by-label/BTRFS_BIGBOY";
# fsType = "btrfs";
# options = [ "nofail" ] ++ btrfs_options ++ btrfs_ssd;
# };
# 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
@ -162,17 +165,17 @@ in
'';
# swap
fileSystems."/swap" = {
device = "/dev/disk/by-label/BTRFS_ROOT";
fsType = "btrfs";
# 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
options = [ "subvol=swap" ] ++ btrfs_options ++ btrfs_ssd;
};
swapDevices = [
{
device = "/swap/swapfile";
size = (1024 * 16) + (1024 * 2); # RAM size + 2 GB
}
];
# fileSystems."/swap" = {
# device = "/dev/disk/by-label/BTRFS_ROOT";
# fsType = "btrfs";
# # 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
# options = [ "subvol=swap" ] ++ btrfs_options ++ btrfs_ssd;
# };
# swapDevices = [
# {
# device = "/swap/swapfile";
# 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";
};
};
};
};
};
};
};
};
};
};
}