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, ... }:
{ {
disko.devices = {
disk.primary = { disk.primary = {
device = builtins.elemAt disks 0; device = [ "/dev/nvme0n1" ];
type = "disk"; type = "disk";
content = { content = {
format = "gpt"; type = "gpt";
type = "table"; partitions = {
partitions = [ # You can't really have a btrfs-layered boot so this'll have to do.
{ ESP = {
name = "root"; priority = 1;
start = "512MiB";
end = "-8GiB";
part-type = "primary";
content = {
type = "filesystem";
mountpoint = "/";
format = "ext4";
};
}
{
name = "ESP";
start = "0"; start = "0";
end = "512MiB"; end = "128MiB";
bootable = true; type = "EF00";
content = { content = {
type = "filesystem"; type = "filesystem";
mountpoint = "/boot"; mountpoint = "/boot";
format = "vfat"; format = "vfat";
}; };
} };
{ root = {
name = "swap"; size = "100%";
start = "-8GiB"; type = "8300";
end = "100%";
part-type = "primary";
content = { content = {
type = "swap"; type = "btrfs";
randomEncryption = true; extraArgs = [ "-f" ];
subvolumes = lib.mkMerge [
{
"/root" = {
mountOptions = [ "compress=zstd" ];
mountpoint = "/";
};
"/home" = {
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";
};
})
]; ];
}; };
}; };
};
};
};
};
} }