diff --git a/configuration.nix b/configuration.nix index 71260a8..c6745b0 100644 --- a/configuration.nix +++ b/configuration.nix @@ -2,7 +2,7 @@ { ############################################################ - # BOOTLOADER – GRUB + # BOOTLOADER – GRUB ############################################################ boot.loader.grub = { @@ -19,9 +19,12 @@ }; ############################################################ - # INITRD – HARDWARE‑AGNOSTIC + LUKS + # INITRD – HARD FAIL, NO RESCUE ############################################################ + boot.initrd.systemd.enable = true; + boot.initrd.emergencyAccess = false; + boot.initrd.availableKernelModules = [ "usb_storage" "xhci_hcd" @@ -40,6 +43,16 @@ allowDiscards = true; }; + ############################################################ + # KERNEL – FAIL DEAD ON I/O LOSS + ############################################################ + + boot.kernelParams = [ + "panic=1" + "oops=panic" + "panic_on_warn=1" + ]; + ############################################################ # FIRMWARE – WIDE HARDWARE SUPPORT ############################################################ @@ -51,7 +64,7 @@ hardware.cpu.amd.updateMicrocode = true; ############################################################ - # FILESYSTEMS – BASED ON LABELS + # FILESYSTEMS – USB ONLY ############################################################ fileSystems."/" = { @@ -64,6 +77,29 @@ fsType = "vfat"; }; + fileSystems."/tmp" = { + fsType = "tmpfs"; + options = [ "mode=1777" "nosuid" "nodev" ]; + }; + + ############################################################ + # MEMORY SAFETY – NO SWAP ANYWHERE + ############################################################ + + swapDevices = [ ]; + zramSwap.enable = false; + + ############################################################ + # POWER MANAGEMENT – DISABLED (CRITICAL) + ############################################################ + + services.logind.lidSwitch = "ignore"; + + systemd.targets.sleep.enable = false; + systemd.targets.suspend.enable = false; + systemd.targets.hibernate.enable = false; + systemd.targets.hybrid-sleep.enable = false; + ############################################################ # NETWORKING ############################################################ @@ -138,7 +174,7 @@ gnomeExtensions.window-list gnomeExtensions.dock-from-dash gnomeExtensions.places-status-indicator - + obsidian libreoffice keepassxc @@ -159,7 +195,6 @@ #!/run/current-system/sw/bin/bash set -e - # Ensure all system tools are available export PATH="/run/current-system/sw/bin:/nix/var/nix/profiles/default/bin" export NIX_PATH="nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixos" @@ -169,50 +204,31 @@ if [ ! -d "$LOCAL_PATH/.git" ]; then mkdir -p "$LOCAL_PATH" chmod 700 "$LOCAL_PATH" - echo "Cloning config from $REPO_URL..." git clone "$REPO_URL" "$LOCAL_PATH" else cd "$LOCAL_PATH" - echo "Fetching updates..." git fetch origin LOCAL_HEAD=$(git rev-parse HEAD) REMOTE_HEAD=$(git rev-parse origin/main) if [ "$LOCAL_HEAD" != "$REMOTE_HEAD" ]; then - echo "New config available. Updating..." git reset --hard origin/main nixos-rebuild switch -I nixos-config="$LOCAL_PATH/configuration.nix" - echo "System updated successfully." - else - echo "Config is already up to date." fi fi ''; environment.etc."update-nixos-config.sh".mode = "0700"; systemd.services.nixos-git-update = { - description = "Update NixOS from public Git config"; + description = "Update NixOS from Git config"; script = "/etc/update-nixos-config.sh"; - serviceConfig = { - Type = "oneshot"; - User = "root"; - Group = "root"; - }; + serviceConfig.Type = "oneshot"; }; systemd.timers.nixos-git-update = { - description = "Check for config updates at startup"; wantedBy = [ "timers.target" ]; - timerConfig = { - OnBootSec = "60s"; - }; + timerConfig.OnBootSec = "60s"; }; - ############################################################ - # USB OPTIMIZATIONS - ############################################################ - - zramSwap.enable = true; - ############################################################ # NIXOS VERSION ############################################################