fix all the issues with persistence, and change GLaDOS to btrfs as an experiment
This commit is contained in:
parent
e86ec419c2
commit
022ec828a8
6 changed files with 84 additions and 49 deletions
|
|
@ -30,8 +30,34 @@
|
||||||
allowDiscards = true;
|
allowDiscards = true;
|
||||||
};
|
};
|
||||||
content = {
|
content = {
|
||||||
type = "lvm_pv";
|
type = "btrfs";
|
||||||
vg = "nvme_pool";
|
extraArgs = ["-f"];
|
||||||
|
subvolumes = {
|
||||||
|
"/root" = {
|
||||||
|
mountpoint = "/";
|
||||||
|
mountOptions = ["subvol=root" "compress=zstd:1" "noatime" "ssd" "discard=async" "space_cache=v2" "commit=120"];
|
||||||
|
};
|
||||||
|
"/home" = {
|
||||||
|
mountpoint = "/home";
|
||||||
|
mountOptions = ["subvol=home" "compress=zstd:1" "noatime" "ssd" "discard=async" "space_cache=v2" "commit=120" "autodefrag"];
|
||||||
|
};
|
||||||
|
"/nix" = {
|
||||||
|
mountpoint = "/nix";
|
||||||
|
mountOptions = ["subvol=nix" "compress=zstd:1" "noatime" "ssd" "discard=async" "space_cache=v2" "commit=120" "nodatacow" "nodatasum"];
|
||||||
|
};
|
||||||
|
"/persist" = {
|
||||||
|
mountpoint = "/persistent";
|
||||||
|
mountOptions = ["subvol=persistent" "compress=zstd:1" "noatime" "ssd" "discard=async" "space_cache=v2" "commit=120"];
|
||||||
|
};
|
||||||
|
"/log" = {
|
||||||
|
mountpoint = "/var/log";
|
||||||
|
mountOptions = ["subvol=log" "compress=zstd:1" "noatime" "ssd" "discard=async" "space_cache=v2" "commit=120" "nodatacow" "nodatasum"];
|
||||||
|
};
|
||||||
|
"/swap" = {
|
||||||
|
mountpoint = "/swap";
|
||||||
|
swap.swapfile.size = "8G";
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
@ -39,32 +65,6 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
lvm_vg = {
|
|
||||||
nvme_pool = {
|
|
||||||
type = "lvm_vg";
|
|
||||||
lvs = {
|
|
||||||
nvme_swap = {
|
|
||||||
size = "32G";
|
|
||||||
content = {
|
|
||||||
type = "swap";
|
|
||||||
discardPolicy = "both";
|
|
||||||
resumeDevice = true; # resume from hiberation from this device
|
|
||||||
};
|
|
||||||
};
|
|
||||||
nvme_root = {
|
|
||||||
size = "100%";
|
|
||||||
content = {
|
|
||||||
type = "filesystem";
|
|
||||||
format = "ext4";
|
|
||||||
mountpoint = "/";
|
|
||||||
mountOptions = [
|
|
||||||
"defaults"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
nodev = {
|
nodev = {
|
||||||
"/home/lillian/Downloads" = {
|
"/home/lillian/Downloads" = {
|
||||||
fsType = "tmpfs";
|
fsType = "tmpfs";
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,10 @@
|
||||||
# This is your home-manager configuration file
|
# This is your home-manager configuration file
|
||||||
# Use this to configure your home environment (it replaces ~/.config/nixpkgs/home.nix)
|
# Use this to configure your home environment (it replaces ~/.config/nixpkgs/home.nix)
|
||||||
{pkgs, ...}: {
|
{
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
# You can import other home-manager modules here
|
# You can import other home-manager modules here
|
||||||
imports = [
|
imports = [
|
||||||
# If you want to use modules your own flake exports (from modules/home-manager):
|
# If you want to use modules your own flake exports (from modules/home-manager):
|
||||||
|
|
@ -22,6 +26,12 @@
|
||||||
vscodium
|
vscodium
|
||||||
unrar
|
unrar
|
||||||
];
|
];
|
||||||
|
home.file = {
|
||||||
|
nextcloud = {
|
||||||
|
source = config.lib.file.mkOutOfStoreSymlink "/run/media/lillian/big-SSD/Nextcloud/";
|
||||||
|
target = "Nextcloud";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
programs.mangohud = {
|
programs.mangohud = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,8 @@
|
||||||
KERNEL=="hidraw*", KERNELS=="*057e:*", MODE="0660", TAG+="uaccess"
|
KERNEL=="hidraw*", KERNELS=="*057e:*", MODE="0660", TAG+="uaccess"
|
||||||
KERNEL=="hidraw*", ATTRS{idVendor}=="2dc8", MODE="0660", TAG+="uaccess"
|
KERNEL=="hidraw*", ATTRS{idVendor}=="2dc8", MODE="0660", TAG+="uaccess"
|
||||||
KERNEL=="hidraw*", KERNELS=="*2DC8:*", MODE="0660", TAG+="uaccess"
|
KERNEL=="hidraw*", KERNELS=="*2DC8:*", MODE="0660", TAG+="uaccess"
|
||||||
|
KERNEL=="hidraw*", ATTRS{idProduct}=="6012", ATTRS{idVendor}=="2dc8", MODE="0660", TAG+="uaccess"
|
||||||
|
KERNEL=="hidraw*", KERNELS=="*2DC8:6012*", MODE="0660", TAG+="uaccess"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
environment.systemPackages = with pkgs;
|
environment.systemPackages = with pkgs;
|
||||||
|
|
@ -60,6 +62,7 @@
|
||||||
pciutils
|
pciutils
|
||||||
podman
|
podman
|
||||||
podman-compose
|
podman-compose
|
||||||
|
python3Minimal
|
||||||
sbctl
|
sbctl
|
||||||
tpm2-tools
|
tpm2-tools
|
||||||
tpm2-tss
|
tpm2-tss
|
||||||
|
|
|
||||||
|
|
@ -75,8 +75,36 @@
|
||||||
# };
|
# };
|
||||||
# };
|
# };
|
||||||
};
|
};
|
||||||
|
|
||||||
boot = {
|
boot = {
|
||||||
|
# Nuke root AND home subvolumes on every boot
|
||||||
|
initrd.systemd.services.wipe-my-fs = {
|
||||||
|
requires = ["dev-mapper-nvme_crypted.device"];
|
||||||
|
after = ["dev-mapper-nvme_crypted.device"];
|
||||||
|
wantedBy = ["initrd.target"];
|
||||||
|
script = ''
|
||||||
|
mkdir -p /btrfs_tmp
|
||||||
|
mount /dev/mapper/cryptroot /btrfs_tmp
|
||||||
|
|
||||||
|
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"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Nuke and recreate root
|
||||||
|
delete_subvolume_recursively /btrfs_tmp/root
|
||||||
|
btrfs subvolume create /btrfs_tmp/root
|
||||||
|
|
||||||
|
# Nuke and recreate home (wipes /home — but we restore via impermanence)
|
||||||
|
delete_subvolume_recursively /btrfs_tmp/home
|
||||||
|
btrfs subvolume create /btrfs_tmp/home
|
||||||
|
|
||||||
|
umount /btrfs_tmp
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
loader.systemd-boot.enable = false;
|
loader.systemd-boot.enable = false;
|
||||||
initrd.systemd.enable = true;
|
initrd.systemd.enable = true;
|
||||||
kernelPackages = pkgs.linuxPackages_latest;
|
kernelPackages = pkgs.linuxPackages_latest;
|
||||||
|
|
@ -89,9 +117,6 @@
|
||||||
pkiBundle = "/var/lib/sbctl";
|
pkiBundle = "/var/lib/sbctl";
|
||||||
};
|
};
|
||||||
extraModprobeConfig = ''
|
extraModprobeConfig = ''
|
||||||
#fix for https://gitlab.freedesktop.org/drm/amd/-/issues/4141
|
|
||||||
amdgpu.runpm=0
|
|
||||||
amdgpu.dcdebugmask=0x10
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,7 @@
|
||||||
{
|
{
|
||||||
file = "/etc/machine-id";
|
file = "/etc/machine-id";
|
||||||
inInitrd = true;
|
inInitrd = true;
|
||||||
|
how = "symlink";
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
file = "/etc/ssh/ssh_host_rsa_key";
|
file = "/etc/ssh/ssh_host_rsa_key";
|
||||||
|
|
@ -155,20 +156,16 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
systemd.services.systemd-machine-id-commit = {
|
||||||
# Create some directories with custom permissions.
|
unitConfig.ConditionPathIsMountPoint = [
|
||||||
#
|
""
|
||||||
# In this configuration the path `/home/butz/.local` is not an immediate parent
|
"/persistent/etc/machine-id"
|
||||||
# of any persisted file, so it would be created with the systemd-tmpfiles default
|
];
|
||||||
# ownership `root:root` and mode `0755`. This would mean that the user `butz`
|
serviceConfig.ExecStart = [
|
||||||
# could not create other files or directories inside `/home/butz/.local`.
|
""
|
||||||
#
|
"systemd-machine-id-setup --commit --root /persistent"
|
||||||
# Therefore systemd-tmpfiles is used to prepare such directories with
|
];
|
||||||
# appropriate permissions.
|
};
|
||||||
#
|
|
||||||
# Note that immediate parent directories of persisted files can also be
|
|
||||||
# configured with ownership and permissions from the `parent` settings if
|
|
||||||
# `configureParent = true` is set for the file.
|
|
||||||
systemd.tmpfiles.settings.preservation = {
|
systemd.tmpfiles.settings.preservation = {
|
||||||
"/home/lillian/.config".d = {
|
"/home/lillian/.config".d = {
|
||||||
user = "lillian";
|
user = "lillian";
|
||||||
|
|
|
||||||
|
|
@ -37,8 +37,8 @@ writeShellApplication
|
||||||
--mode zap_create_mount \
|
--mode zap_create_mount \
|
||||||
"./disko/''${dir}/default.nix"
|
"./disko/''${dir}/default.nix"
|
||||||
echo "NixOS Installing..."
|
echo "NixOS Installing..."
|
||||||
sudo nixos-install --flake .#"''${dir}" --show-trace --log-format internal-json -v |& nom --json
|
sudo nixos-install --flake .#"''${dir}" --show-trace -v |& nom
|
||||||
sudo nixos-install --flake .#"''${dir}" --show-trace --log-format internal-json -v |& nom --json
|
sudo nixos-install --flake .#"''${dir}" --show-trace -v |& nom
|
||||||
popd > /dev/null
|
popd > /dev/null
|
||||||
echo "Cleaning up repository in '/tmp/install-nix'..."
|
echo "Cleaning up repository in '/tmp/install-nix'..."
|
||||||
rm -rf ./install-nix
|
rm -rf ./install-nix
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue