feat(akhaten): enable impermanence

This commit is contained in:
Julien Malka 2024-08-21 23:27:25 +02:00
parent a8a2c80d52
commit 0a0f3ad1eb
Signed by: Luj
GPG key ID: 6FC74C847011FD83
3 changed files with 73 additions and 6 deletions

View file

@ -1,4 +1,4 @@
{ inputs, ... }:
{ inputs, config, ... }:
{
imports = [
./hardware.nix
@ -18,9 +18,27 @@
};
deployment.tags = [ "server" ];
deployment.targetHost = config.machine.meta.ips.public.ipv4;
disko = import ./disko.nix;
environment.persistence."/persistent" = {
hideMounts = true;
directories = [
"/var/lib"
"/var/log"
"/srv"
];
files = [
"/etc/machine-id"
"/etc/ssh/ssh_host_ed25519_key"
"/etc/ssh/ssh_host_ed25519_key.pub"
];
};
fileSystems."/srv".neededForBoot = true;
fileSystems."/persistent".neededForBoot = true;
services.fail2ban.enable = true;
networking.useNetworkd = true;

View file

@ -9,7 +9,7 @@
partitions = {
boot = {
size = "1M";
type = "EF02"; # for grub MBR
type = "EF02";
};
ESP = {
size = "512M";
@ -20,17 +20,60 @@
mountpoint = "/boot";
};
};
swap = {
size = "16G";
content = {
type = "swap";
discardPolicy = "both";
};
};
root = {
size = "100%";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/";
type = "lvm_pv";
vg = "mainpool";
};
};
};
};
};
};
lvm_vg = {
mainpool = {
type = "lvm_vg";
lvs = {
root = {
size = "100G";
pool = "mainpool";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/";
mountOptions = [ "defaults" ];
};
};
persistent = {
size = "100G";
pool = "mainpool";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/persistent";
mountOptions = [ "defaults" ];
};
};
store = {
size = "600G";
pool = "mainpool";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/nix";
};
};
};
};
};
};
}

View file

@ -2,18 +2,24 @@
config,
lib,
modulesPath,
pkgs,
...
}:
{
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
boot.loader.grub.enable = true;
boot.initrd.availableKernelModules = [ "ahci" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
swapDevices = [ { device = "/dev/disk/by-uuid/b2563fcf-18af-43da-b2d2-3e7b84f72421"; } ];
boot.initrd.postDeviceCommands = ''
lvm lvremove --force /dev/mainpool/root || :
yes | lvm lvcreate --size 100G --name root mainpool
${pkgs.e2fsprogs}/bin/mkfs.ext4 /dev/mainpool/root
'';
networking.useDHCP = lib.mkDefault true;