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

View File

@@ -25,7 +25,12 @@
# ========= Disk Layout =========
#
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 =========
@@ -67,6 +72,7 @@
#
hostSpec = {
hostName = "rihla";
useYubikey = lib.mkForce true;
};
networking = {

View File

@@ -40,6 +40,16 @@
description = "The home directory of the user";
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 {
type = lib.types.bool;
default = false;