hosts/ni: convert to btrfs-based filesystem setup

This commit is contained in:
Gabriel Arazas 2024-02-23 07:24:21 +08:00
parent a2f7dbb86e
commit 643d05a0f7
No known key found for this signature in database
GPG Key ID: ADE0C41DAB221FCC
2 changed files with 59 additions and 43 deletions

View File

@ -6,6 +6,10 @@
# Include the results of the hardware scan. # Include the results of the hardware scan.
./hardware-configuration.nix ./hardware-configuration.nix
# Include the disko configuration.
./disko.nix
./modules ./modules
]; ];
@ -27,10 +31,6 @@
# Enable the display manager of choice. # Enable the display manager of choice.
services.xserver.displayManager.gdm.enable = true; services.xserver.displayManager.gdm.enable = true;
disko.devices = import ./disko.nix {
disks = [ "/dev/nvme0n1" ];
};
services.openssh.hostKeys = [{ services.openssh.hostKeys = [{
path = config.sops.secrets."ssh-key".path; path = config.sops.secrets."ssh-key".path;
type = "ed25519"; type = "ed25519";

View File

@ -1,48 +1,64 @@
{ disks ? [ "/dev/nvme0n1" ], ... }: { config, lib, ... }:
{ {
disk.primary = { disko.devices = {
device = builtins.elemAt disks 0; disk.primary = {
type = "disk"; device = [ "/dev/nvme0n1" ];
content = { type = "disk";
format = "gpt"; content = {
type = "table"; type = "gpt";
partitions = [ partitions = {
{ # You can't really have a btrfs-layered boot so this'll have to do.
name = "root"; ESP = {
start = "512MiB"; priority = 1;
end = "-8GiB"; start = "0";
part-type = "primary"; end = "128MiB";
content = { type = "EF00";
type = "filesystem"; content = {
mountpoint = "/"; type = "filesystem";
format = "ext4"; mountpoint = "/boot";
format = "vfat";
};
}; };
}
{ root = {
name = "ESP"; size = "100%";
start = "0"; type = "8300";
end = "512MiB"; content = {
bootable = true; type = "btrfs";
content = { extraArgs = [ "-f" ];
type = "filesystem";
mountpoint = "/boot";
format = "vfat";
};
}
{ subvolumes = lib.mkMerge [
name = "swap"; {
start = "-8GiB"; "/root" = {
end = "100%"; mountOptions = [ "compress=zstd" ];
part-type = "primary"; mountpoint = "/";
content = { };
type = "swap"; "/home" = {
randomEncryption = true; mountOptions = [ "compress=zstd" ];
mountpoint = "/home";
};
"/nix" = {
mountOptions = [ "compress=zstd" "noatime" "noattr" "noacl" ];
mountpoint = "/nix";
};
"/swap" = {
mountpoint = "/.swapvol";
swap.swapfile.size = "8G";
};
}
(lib.mkIf config.services.guix.enable {
"/gnu" = {
mountOptions = [ "compress=zstd" "noatime" "noattr" "noacl" ];
mountpoint = "/gnu";
};
})
];
};
}; };
} };
]; };
}; };
}; };
} }