mirror of
https://github.com/JulienMalka/snowfield.git
synced 2025-03-30 08:40:52 +02:00
feat(akhaten): enable impermanence
This commit is contained in:
parent
a8a2c80d52
commit
0a0f3ad1eb
3 changed files with 73 additions and 6 deletions
|
@ -1,4 +1,4 @@
|
||||||
{ inputs, ... }:
|
{ inputs, config, ... }:
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./hardware.nix
|
./hardware.nix
|
||||||
|
@ -18,9 +18,27 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
deployment.tags = [ "server" ];
|
deployment.tags = [ "server" ];
|
||||||
|
deployment.targetHost = config.machine.meta.ips.public.ipv4;
|
||||||
|
|
||||||
disko = import ./disko.nix;
|
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;
|
services.fail2ban.enable = true;
|
||||||
|
|
||||||
networking.useNetworkd = true;
|
networking.useNetworkd = true;
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
partitions = {
|
partitions = {
|
||||||
boot = {
|
boot = {
|
||||||
size = "1M";
|
size = "1M";
|
||||||
type = "EF02"; # for grub MBR
|
type = "EF02";
|
||||||
};
|
};
|
||||||
ESP = {
|
ESP = {
|
||||||
size = "512M";
|
size = "512M";
|
||||||
|
@ -20,17 +20,60 @@
|
||||||
mountpoint = "/boot";
|
mountpoint = "/boot";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
swap = {
|
||||||
|
size = "16G";
|
||||||
|
content = {
|
||||||
|
type = "swap";
|
||||||
|
discardPolicy = "both";
|
||||||
|
};
|
||||||
|
};
|
||||||
root = {
|
root = {
|
||||||
size = "100%";
|
size = "100%";
|
||||||
content = {
|
content = {
|
||||||
type = "filesystem";
|
type = "lvm_pv";
|
||||||
format = "ext4";
|
vg = "mainpool";
|
||||||
mountpoint = "/";
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
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";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,18 +2,24 @@
|
||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
modulesPath,
|
modulesPath,
|
||||||
|
pkgs,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
|
||||||
{
|
{
|
||||||
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
|
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
|
||||||
|
|
||||||
boot.loader.grub.enable = true;
|
boot.loader.grub.enable = true;
|
||||||
boot.initrd.availableKernelModules = [ "ahci" ];
|
boot.initrd.availableKernelModules = [ "ahci" ];
|
||||||
boot.initrd.kernelModules = [ ];
|
boot.initrd.kernelModules = [ ];
|
||||||
boot.kernelModules = [ "kvm-intel" ];
|
boot.kernelModules = [ "kvm-intel" ];
|
||||||
boot.extraModulePackages = [ ];
|
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;
|
networking.useDHCP = lib.mkDefault true;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue