io is now ephermal
This commit is contained in:
parent
b1f38f47d8
commit
379831e348
3 changed files with 89 additions and 26 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
{ ... }:
|
{ ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
imports = [ ./hardware-configuration.nix ];
|
imports = [ ./ephermal.nix ./hardware-configuration.nix ];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
44
hosts/desktops/io/ephermal.nix
Normal file
44
hosts/desktops/io/ephermal.nix
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
{ 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/ef1916a9-e15c-450e-8100-4b2af9f6e1a5 /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
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -1,40 +1,59 @@
|
||||||
# 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 = {
|
||||||
|
initrd = {
|
||||||
|
availableKernelModules =
|
||||||
[ "xhci_pci" "ahci" "usb_storage" "sd_mod" "sdhci_pci" ];
|
[ "xhci_pci" "ahci" "usb_storage" "sd_mod" "sdhci_pci" ];
|
||||||
boot.initrd.kernelModules = [ ];
|
luks.devices."cryptroot".device =
|
||||||
boot.kernelModules = [ "kvm-intel" ];
|
"/dev/disk/by-uuid/37c930c5-2b31-4d18-a1c4-7f13e0412656";
|
||||||
boot.extraModulePackages = [ ];
|
};
|
||||||
|
kernelModules = [ "kvm-intel" ];
|
||||||
fileSystems."/" = {
|
|
||||||
device = "/dev/disk/by-uuid/2321ee32-a952-4a4b-bba0-bb25f616a4a5";
|
|
||||||
fsType = "ext4";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
boot.initrd.luks.devices."luks-008bb7cb-917c-4dda-93fe-542c2285bafb".device =
|
fileSystems = {
|
||||||
"/dev/disk/by-uuid/008bb7cb-917c-4dda-93fe-542c2285bafb";
|
"/" = {
|
||||||
|
device = "/dev/disk/by_uuid/ef1916a9-e15c-450e-8100-4b2af9f6e1a5";
|
||||||
fileSystems."/boot/efi" = {
|
fsType = "btrfs";
|
||||||
|
options = [ "subvol=@root" "noatime" "compress=zstd" ];
|
||||||
|
};
|
||||||
|
"/home" = {
|
||||||
|
device = "/dev/disk/by_uuid/ef1916a9-e15c-450e-8100-4b2af9f6e1a5";
|
||||||
|
fsType = "btrfs";
|
||||||
|
options = [ "subvol=@home" "noatime" "compress=zstd" ];
|
||||||
|
};
|
||||||
|
"/boot/efi" = {
|
||||||
device = "/dev/disk/by-uuid/36B4-C473";
|
device = "/dev/disk/by-uuid/36B4-C473";
|
||||||
fsType = "vfat";
|
fsType = "vfat";
|
||||||
|
options = [ "noatime" "fmask=0077" "dmask=0077" ];
|
||||||
|
};
|
||||||
|
"/nix" = {
|
||||||
|
device = "/dev/disk/by_uuid/ef1916a9-e15c-450e-8100-4b2af9f6e1a5";
|
||||||
|
fsType = "btrfs";
|
||||||
|
options = [ "subvol=@nix" "noatime" "compress=zstd" ];
|
||||||
|
};
|
||||||
|
"/persistent" = {
|
||||||
|
device = "/dev/disk/by_uuid/ef1916a9-e15c-450e-8100-4b2af9f6e1a5";
|
||||||
|
fsType = "btrfs";
|
||||||
|
options = [ "subvol=@persistent" "noatime" "compress=zstd" ];
|
||||||
|
};
|
||||||
|
"/swap" = {
|
||||||
|
device = "/dev/disk/by_uuid/ef1916a9-e15c-450e-8100-4b2af9f6e1a5";
|
||||||
|
fsType = "btrfs";
|
||||||
|
options = [ "subvol=@swap" "noatime" ];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
swapDevices = [ ];
|
swapDevices = [{ "/swap/swapfile"; }];
|
||||||
|
|
||||||
# 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.wlp0s20f3.useDHCP = lib.mkDefault true;
|
|
||||||
|
nixpkgs.hostPlatform = lib.mkDefault "x86_64";
|
||||||
|
|
||||||
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
|
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
|
||||||
|
|
||||||
hardware.cpu.intel.updateMicrocode =
|
hardware.cpu.intel.updateMicrocode =
|
||||||
lib.mkDefault config.hardware.enableRedistributableFirmware;
|
lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue