Wtf why did it remove everything.

This commit is contained in:
Jimbo 2025-02-28 12:21:09 -05:00
parent d58b606d90
commit 2144d9ef61
73 changed files with 1077 additions and 0 deletions

View file

@ -0,0 +1,10 @@
{ config, lib, ... }:
{
options.system.extlinux.enable = lib.mkEnableOption "Enable extlinux";
config.boot.loader = lib.mkIf config.system.extlinux.enable {
grub.enable = false;
systemd-boot.enable = lib.mkForce false;
generic-extlinux-compatible.enable = true;
};
}

View file

@ -0,0 +1,6 @@
{ ... }:
{
imports = [ ./root-reset ];
boot.initrd.systemd.enable = true;
}

View file

@ -0,0 +1,31 @@
{ config, ... }:
{
boot.initrd.systemd.services.root-reset = {
enable = config.environment.persistence."/persist".enable;
description = "Create new and snapshot previous root";
wantedBy = [ "initrd.target" ];
before = [ "sysroot.mount" ];
after = [ "initrd-root-device.target" ];
unitConfig.DefaultDependencies = "no";
serviceConfig.Type = "oneshot";
script = ''
mkdir -p /mnt
mount -t btrfs /dev/${config.networking.hostName}/root /mnt
if [[ -e /mnt/prev ]]; then
btrfs subvolume delete /mnt/prev
fi
btrfs subvolume snapshot /mnt/root /mnt/prev
btrfs subvolume list -o /mnt/root | cut -f9 -d' ' | while read subvolume; do
btrfs subvolume delete "/mnt/$subvolume"
done
btrfs subvolume delete /mnt/root
btrfs subvolume create /mnt/root
umount /mnt
'';
};
}

View file

@ -0,0 +1,9 @@
{ ... }:
{
imports = [
./filesystems
./immutable
./impermanence
./snapper
];
}

View file

@ -0,0 +1,13 @@
{ pkgs, ... }:
{
boot.supportedFilesystems = {
btrfs = true;
ntfs = true;
zfs = true;
};
services = {
btrfs.autoScrub.enable = true;
fstrim.enable = true;
};
}

View file

@ -0,0 +1,5 @@
{ ... }:
{
system.etc.overlay.mutable = false;
boot.tmp.cleanOnBoot = true;
}

View file

@ -0,0 +1,8 @@
{ impermanence, ... }:
{
imports = [
./main
./root
impermanence.nixosModules.impermanence
];
}

View file

@ -0,0 +1,46 @@
{ config, ... }:
{
environment.persistence."/persist" = {
hideMounts = true;
users.${config.sysusers.main} = {
directories = [
"Keepers"
"Documents"
"Pictures"
"Videos"
"Games"
"VMs"
".snapshots"
".mozilla"
".thunderbird"
".config/blender"
".config/dconf"
".config/vesktop"
".config/sunshine"
".config/heroic"
".config/obs-studio"
".local/share/mpd"
".local/share/nvim/undo"
".local/share/PrismLauncher"
".local/share/Steam"
".local/share/TelegramDesktop"
".local/state/wireplumber"
".cache/nix-index"
{ directory = ".ssh"; mode = "0700"; }
{ directory = ".gnupg"; mode = "0700"; }
{ directory = ".local/share/keyrings"; mode = "0700"; }
];
files = [
".zsh_history"
".local/state/lazygit/state.yml"
".local/share/applications" # Create directory so nothing generates inside of it
];
};
};
}

View file

@ -0,0 +1,15 @@
{ ... }:
{
environment.persistence."/persist" = {
hideMounts = true;
directories = [
"/etc/nixos"
"/etc/secureboot"
"/var/lib/nixos"
];
files = [
"/etc/machine-id"
"/root/.gitconfig"
];
};
}

View file

@ -0,0 +1,12 @@
{ ... }:
{
imports = [
./main
./root
];
services.snapper = {
snapshotInterval = "0/6:00:00";
persistentTimer = true;
};
}

View file

@ -0,0 +1,12 @@
{ config, lib, ... }:
{
services.snapper.configs.${config.sysusers.main} = lib.mkIf config.environment.persistence."/persist".enable {
SUBVOLUME = "/persist/home/${config.sysusers.main}";
TIMELINE_CREATE = true;
TIMELINE_CLEANUP = true;
TIMELINE_LIMIT_DAILY = 1;
TIMELINE_LIMIT_WEEKLY = 1;
TIMELINE_LIMIT_MONTHLY = 0;
TIMELINE_LIMIT_YEARLY = 0;
};
}

View file

@ -0,0 +1,12 @@
{ config, lib, ... }:
{
services.snapper.configs.root = lib.mkIf config.environment.persistence."/persist".enable {
SUBVOLUME = "/persist";
TIMELINE_CREATE = true;
TIMELINE_CLEANUP = true;
TIMELINE_LIMIT_DAILY = 1;
TIMELINE_LIMIT_WEEKLY = 0;
TIMELINE_LIMIT_MONTHLY = 0;
TIMELINE_LIMIT_YEARLY = 0;
};
}

View file

@ -0,0 +1,13 @@
{ config, lib, pkgs, ... }:
{
options.system.wireless.enable = lib.mkEnableOption "Enable wireless stack";
config = lib.mkIf config.system.wireless.enable {
networking.wireless.iwd.enable = true;
environment = {
systemPackages = with pkgs; [ impala ];
persistence."/persist".directories = [ "/var/lib/iwd/" ];
};
};
}