feat: Rihla | prepare for impermanence

This commit is contained in:
2025-02-16 17:32:37 +05:00
parent 74a4772ad9
commit ecce02959b
3 changed files with 37 additions and 8 deletions

View File

@@ -1,9 +1,20 @@
{
lib,
config,
device,
withSwap,
swapSize,
label,
...
}:
{ {
disko = { disko = {
devices = { devices = {
disk = { disk = {
main = { main = {
device = "/dev/nvme0n1"; inherit device;
type = "disk"; type = "disk";
content = { content = {
type = "gpt"; type = "gpt";
@@ -50,8 +61,8 @@
crypt_vg = { crypt_vg = {
type = "lvm_vg"; type = "lvm_vg";
lvs = { lvs = {
swap = { swap = lib.mkIf withSwap {
size = "64G"; size = "${swapSize}G";
content = { content = {
type = "swap"; type = "swap";
resumeDevice = true; resumeDevice = true;
@@ -63,20 +74,22 @@
type = "btrfs"; type = "btrfs";
extraArgs = [ extraArgs = [
"-L" "-L"
"nixos" label
"-f" "-f"
]; ];
subvolumes = { subvolumes = {
"@root" = { "@root" = {
mountpoint = "/"; mountpoint = "/";
mountOptions = [ mountOptions = [
"subvol=root"
"compress=zstd" "compress=zstd"
"noatime"
]; ];
}; };
"@home" = { "@persist" = {
mountpoint = "/home"; mountpoint = config.hostSpec.persist;
mountOptions = [ mountOptions = [
"subvol=home" "subvol=persist"
"compress=zstd" "compress=zstd"
"noatime" "noatime"
]; ];

View File

@@ -25,7 +25,12 @@
# ========= Disk Layout ========= # ========= Disk Layout =========
# #
inputs.disko.nixosModules.disko inputs.disko.nixosModules.disko
(lib.custom.relativeToRoot "hosts/common/disks/rihla.nix") (lib.custom.relativeToRoot "hosts/common/disks/rihla.nix") {
device = "/dev/nvme0n1";
withSwap = true;
swapSize = 64;
label = "nixos";
}
# #
# ========= Required Configs ========= # ========= Required Configs =========
@@ -67,6 +72,7 @@
# #
hostSpec = { hostSpec = {
hostName = "rihla"; hostName = "rihla";
useYubikey = lib.mkForce true;
}; };
networking = { networking = {

View File

@@ -40,6 +40,16 @@
description = "The home directory of the user"; description = "The home directory of the user";
default = "/home/${config.hostSpec.username}"; default = "/home/${config.hostSpec.username}";
}; };
impermenance = lib.mkOption {
type = lib.types.bool;
description = "Whether or not to enable impermenance";
default = false;
};
persist = lib.mkOption {
type = lib.types.str;
description = "The folder to persist data if impermenance is enabled";
default = "/persist";
};
useYubikey = lib.mkOption { useYubikey = lib.mkOption {
type = lib.types.bool; type = lib.types.bool;
default = false; default = false;