feat(stolas): disko for disk setup

This commit is contained in:
Tim Schubert 2025-07-13 21:53:21 +02:00
parent 0b08beee35
commit e58a47af3f
No known key found for this signature in database
5 changed files with 127 additions and 109 deletions

View file

@ -1,6 +1,7 @@
{
self,
agenix,
disko,
home-manager,
homepage,
nixos-hardware,
@ -40,6 +41,7 @@ in
extraModules = [
# TODO lanzaboote.nixosModules.lanzaboote
disko.nixosModules.disko
{
nixpkgs.overlays = nixpkgs.lib.attrValues self.overlays;
dadada.pkgs = self.packages.${system};

View file

@ -3,10 +3,9 @@
imports = [
../modules/profiles/laptop.nix
./disks.nix
];
### TODO double check with generated hw-config
boot = {
# TODO lanzaboote = {
# enable = true;
@ -47,113 +46,6 @@
pkgs.sbctl
];
# TODO compare with nixos-generate-config --show-hardware-config
fileSystems = {
"/boot" = {
# TODO
device = "/dev/disk/by-uuid/todo";
fsType = "vfat";
};
"/" = {
# TODO
device = "/dev/disk/by-uuid/todo";
fsType = "btrfs";
options = [
"subvol=root"
"compress=zstd"
];
};
"/home" = {
# TODO
device = "/dev/disk/by-uuid/todo";
options = [
"compress=zstd"
"subvol=home"
];
};
"/home/dadada" = {
# TODO
device = "/dev/disk/by-uuid/todo";
options = [
"compress=zstd"
"subvol=home/dadada"
];
};
"/nix" = {
# TODO
device = "/dev/disk/by-uuid/todo";
fsType = "btrfs";
options = [
"noatime"
"compress=zstd"
"subvol=nix"
];
};
"/nix/var/nix/builds" = {
device = "none";
fsType = "tmpfs";
options = [
# Max 80% of available RAM
"size=80%"
# Only owner (nix daemon may write)
"mode=755"
];
};
"/root" = {
# TODO
device = "/dev/disk/by-uuid/todo";
fsType = "btrfs";
options = [
"compress=zstd"
"subvol=root"
];
};
"/var" = {
# TODO
device = "/dev/disk/by-uuid/todo";
fsType = "btrfs";
options = [
"compress=zstd"
"subvol=var"
];
};
"/var/lib/paperless" = {
# TODO
device = "/dev/disk/by-uuid/todo";
fsType = "btrfs";
options = [
"compress=zstd"
"subvol=var/lib/paperless"
];
};
"/var/swap" = {
# TODO
device = "/dev/disk/by-uuid/todo";
fsType = "btrfs";
options = [
"noatime"
"subvol=swap"
];
};
# NOTE: /tmp is tmpfs because of config in base.nix
};
# TODO btrfs filesystem mkswapfile --uuid clear /var/swap/swapfile
# swapDevices = [{
# device = "/var/swap/swapfile";
# size = 80*1024; # Creates an 80GB swap file
# }];
hardware = {
# NOTE: hardware.framework.enableKmod requires kernel patching, but enables access to some EC features
bluetooth.enable = true;

99
nixos/stolas/disks.nix Normal file
View file

@ -0,0 +1,99 @@
{
disko.devices = {
nodev."/nix/var/nix/builds" = {
fsType = "tmpfs";
mountOptions = [
"size=80%"
"defaults"
"mode=755"
];
};
disk = {
main = {
type = "disk";
device = "/dev/disk/by-uuid/TODO";
content = {
type = "gpt";
partitions = {
ESP = {
size = "1G";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [ "umask=0077" ];
};
};
# TODO tmpfs for nix/var/nix/builds
luks = {
size = "100%";
content = {
type = "luks";
name = "crypted";
#passwordFile = "/tmp/secret.key"; # Interactive
settings = {
allowDiscards = true;
#keyFile = "/tmp/secret.key";
};
#additionalKeyFiles = [ "/tmp/additionalSecret.key" ];
content = {
type = "btrfs";
extraArgs = [ "-f" ];
subvolumes = {
"/root" = {
mountpoint = "/";
mountOptions = [
"compress=zstd"
"relatime"
];
};
"/home" = {
mountpoint = "/home";
mountOptions = [
"compress=zstd"
"noatime"
];
};
"/dadada" = {
mountpoint = "/home/dadada";
mountOptions = [
"compress=zstd"
"relatime"
];
};
"/nix" = {
mountpoint = "/nix";
mountOptions = [
"compress=zstd"
"noatime"
];
};
"/var" = {
mountpoint = "/var";
mountOptions = [
"compress=zstd"
"noatime"
];
};
"/paperless" = {
mountpoint = "/var/lib/paperless";
mountOptions = [
"compress=zstd"
"noatime"
];
};
"/swap" = {
mountpoint = "/.swapvol";
swap.swapfile.size = "64G";
};
};
};
};
};
};
};
};
};
};
}