Continue refactor towards disko

This commit is contained in:
Jimbo 2024-11-06 11:49:40 -05:00
parent f2cdf01122
commit fe16e208b6
25 changed files with 476 additions and 249 deletions

View file

@ -7,7 +7,7 @@
initrd = {
systemd = {
enable = true;
services.root-reset = {
services.root-reset = {
description = "Reset BTRFS root and snapshot last boot";
wantedBy = [ "initrd.target" ];
after = [ "dev-nixos-root.device" ];

View file

@ -1,14 +1,12 @@
{ disko, ... }:
{ disko, config, ... }:
{
imports = [
disko.nixosModules.disko
];
imports = [ disko.nixosModules.disko ];
disko.devices = {
disk = {
main = {
"${config.networking.hostName}" = {
type = "disk";
device = "/dev/sda";
device = "/dev/nvme0n1";
content = {
type = "gpt";
partitions = {
@ -26,12 +24,12 @@
size = "100%";
content = {
type = "luks";
name = "crypt-hdd";
name = "crypt-nvme";
settings.allowDiscards = true;
#passwordFile = "/tmp/secret.key";
passwordFile = "/tmp/secret.key";
content = {
type = "lvm_pv";
vg = "nixos";
vg = "${config.networking.hostName}";
};
};
};
@ -41,7 +39,7 @@
};
lvm_vg = {
nixos = {
"${config.networking.hostName}" = {
type = "lvm_vg";
lvs = {
root = {
@ -50,28 +48,31 @@
type = "btrfs";
extraArgs = [ "-f" ];
subvolumes = {
"/@" = {
"/root" = {
mountpoint = "/";
mountOptions = [ "compress=zstd" "noatime" ];
};
"/@prev" = {
"/prev" = {
mountpoint = "/prev";
mountOptions = [ "compress=zstd" "noatime" ];
};
"/@nix" = {
"/nix" = {
mountpoint = "/nix";
mountOptions = [ "compress=zstd" "noatime" ];
};
# Impermanence
"/@root" = {
"/persist" = {
mountpoint = "/persist";
mountOptions = [ "compress=zstd" "noatime" ];
};
"/@jimbo" = {
"/persist/.snapshots" = { };
"/jimbo" = {
mountpoint = "/persist/home/jimbo";
mountOptions = [ "compress=zstd" "noatime" ];
};
"/jimbo/.snapshots" = { };
};
};
};