we are not ephemeral
This commit is contained in:
parent
79de44c84b
commit
1ea4104d3a
4 changed files with 84 additions and 26 deletions
|
|
@ -4,7 +4,7 @@
|
||||||
boot = {
|
boot = {
|
||||||
loader = {
|
loader = {
|
||||||
timeout = 1;
|
timeout = 1;
|
||||||
efi.canTouchEfiVariables = true;
|
# efi.canTouchEfiVariables = true;
|
||||||
systemd-boot = {
|
systemd-boot = {
|
||||||
enable = true;
|
enable = true;
|
||||||
editor = false;
|
editor = false;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
{ ... }:
|
{ ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
imports = [ ./hardware-configuration.nix ];
|
imports = [ ./hardware-configuration.nix ./ephermal.nix ];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
45
hosts/desktops/rotterdam/ephermal.nix
Normal file
45
hosts/desktops/rotterdam/ephermal.nix
Normal file
|
|
@ -0,0 +1,45 @@
|
||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
boot.initrd.systemd.services.recreate-root = {
|
||||||
|
description = "Rolling over and creating new filesystem root";
|
||||||
|
requires = [ "initrd-root-device.target" ];
|
||||||
|
after = [ "local-fs-pre.target" "initrd-root-device.target" ];
|
||||||
|
requiredBy = [ "initrd-root-fs.target" ];
|
||||||
|
before = [ "sysroot.mount" ];
|
||||||
|
unitConfig = {
|
||||||
|
AssertPathExists = "/etc/initrd-release";
|
||||||
|
DefaultDependencies = false;
|
||||||
|
};
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "oneshot";
|
||||||
|
RemainAfterExit = true;
|
||||||
|
};
|
||||||
|
script = ''
|
||||||
|
mkdir /btrfs_tmp
|
||||||
|
mount /dev/disk/by-uuid/3287dbc3-c0fa-4096-a0b3-59b017cfecc8 /btrfs_tmp
|
||||||
|
|
||||||
|
if [[ -e /btrfs_tmp/@root ]]; then
|
||||||
|
mkdir -p /btrfs_tmp/old_roots
|
||||||
|
timestamp=$(date --date="@$(stat -c %Y /btrfs_tmp/@root)" "+%Y-%m-%-d_%H:%M:%S")
|
||||||
|
mv /btrfs_tmp/@root "/btrfs_tmp/old_roots/$timestamp"
|
||||||
|
fi
|
||||||
|
|
||||||
|
delete_subvolume_recursively() {
|
||||||
|
IFS=$'\n'
|
||||||
|
for i in $(btrfs subvolume list -o "$1" | cut -f 9- -d ' '); do
|
||||||
|
delete_subvolume_recursively "/btrfs_tmp/$i"
|
||||||
|
done
|
||||||
|
btrfs subvolume delete "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
for i in $(find /btrfs_tmp/old_roots/ -maxdepth 1 -mtime +30); do
|
||||||
|
delete_subvolume_recursively "$i"
|
||||||
|
done
|
||||||
|
|
||||||
|
btrfs subvolume create /btrfs_tmp/@root
|
||||||
|
umount /btrfs_tmp
|
||||||
|
rmdir btrfs_tmp
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -1,37 +1,50 @@
|
||||||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
{ config, lib, modulesPath, ... }:
|
||||||
# and may be overwritten by future invocations. Please make changes
|
|
||||||
# to /etc/nixos/configuration.nix instead.
|
|
||||||
{ config, pkgs, lib, modulesPath, ... }:
|
|
||||||
|
|
||||||
{
|
{
|
||||||
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
|
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
|
||||||
|
|
||||||
boot.initrd.availableKernelModules =
|
boot = {
|
||||||
[ "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ];
|
initrd = {
|
||||||
boot.initrd.kernelModules = [ ];
|
availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usbhid" "sd_mod" ];
|
||||||
boot.kernelModules = [ "kvm-amd" ];
|
luks.devices."cryptroot".device =
|
||||||
boot.extraModulePackages = [ ];
|
"/dev/disk/by-uuid/f7dd4142-7109-4493-834d-4a831777f08d";
|
||||||
|
};
|
||||||
fileSystems."/" = {
|
kernelModules = [ "kvm-amd" ];
|
||||||
device = "/dev/disk/by-uuid/9ccbb9e3-addc-42a3-b5d8-1e81eed37548";
|
|
||||||
fsType = "ext4";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
fileSystems."/boot/efi" = {
|
fileSystems = {
|
||||||
device = "/dev/disk/by-uuid/7707-0E25";
|
"/" = {
|
||||||
fsType = "vfat";
|
device = "/dev/disk/by-uuid/3287dbc3-c0fa-4096-a0b3-59b017cfecc8";
|
||||||
|
fsType = "btrfs";
|
||||||
|
options = [ "subvol=@root" "noatime" "compress=zstd" ];
|
||||||
|
};
|
||||||
|
"/boot/efi" = {
|
||||||
|
device = "/dev/disk/by-uuid/1F5A-8945";
|
||||||
|
fsType = "vfat";
|
||||||
|
options = [ "noatime" "fmask=0077" "dmask=0077" ];
|
||||||
|
};
|
||||||
|
"/nix" = {
|
||||||
|
device = "/dev/disk/by-uuid/3287dbc3-c0fa-4096-a0b3-59b017cfecc8";
|
||||||
|
fsType = "btrfs";
|
||||||
|
options = [ "subvol=@nix" "noatime" "compress=zstd" ];
|
||||||
|
};
|
||||||
|
"/persistent" = {
|
||||||
|
device = "/dev/disk/by-uuid/3287dbc3-c0fa-4096-a0b3-59b017cfecc8";
|
||||||
|
fsType = "btrfs";
|
||||||
|
options = [ "subvol=@persistent" "noatime" "compress=zstd" ];
|
||||||
|
};
|
||||||
|
"/swap" = {
|
||||||
|
device = "/dev/disk/by-uuid/3287dbc3-c0fa-4096-a0b3-59b017cfecc8";
|
||||||
|
fsType = "btrfs";
|
||||||
|
options = [ "subvol=@swap" "noatime" ];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
swapDevices =
|
swapDevices = [{ device = "/swap/swapfile"; }];
|
||||||
[{ device = "/dev/disk/by-uuid/39005453-0ac9-4fee-bdd3-7ea9bb6f9ca6"; }];
|
|
||||||
|
|
||||||
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
|
||||||
# (the default) this is the recommended approach. When using systemd-networkd it's
|
|
||||||
# still possible to use this option, but it's recommended to use it in conjunction
|
|
||||||
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
|
|
||||||
networking.useDHCP = lib.mkDefault true;
|
networking.useDHCP = lib.mkDefault true;
|
||||||
# networking.interfaces.enp34s0.useDHCP = lib.mkDefault true;
|
|
||||||
# networking.interfaces.wlo1.useDHCP = lib.mkDefault true;
|
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||||
|
|
||||||
hardware.cpu.amd.updateMicrocode =
|
hardware.cpu.amd.updateMicrocode =
|
||||||
lib.mkDefault config.hardware.enableRedistributableFirmware;
|
lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue