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

View File

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