Update configuration.nix

This commit is contained in:
ska
2025-12-23 12:17:06 +00:00
parent 7bff1a4cc7
commit f1f452aea4

View File

@@ -19,11 +19,9 @@
}; };
############################################################ ############################################################
# INITRD HARD FAIL, NO RESCUE # INITRD HARDWAREAGNOSTIC + LUKS
############################################################ ############################################################
boot.initrd.systemd.enable = true;
boot.initrd.availableKernelModules = [ boot.initrd.availableKernelModules = [
"usb_storage" "usb_storage"
"xhci_hcd" "xhci_hcd"
@@ -42,16 +40,6 @@
allowDiscards = true; allowDiscards = true;
}; };
############################################################
# KERNEL FAIL DEAD ON I/O LOSS
############################################################
boot.kernelParams = [
"panic=1"
"oops=panic"
"panic_on_warn=1"
];
############################################################ ############################################################
# FIRMWARE WIDE HARDWARE SUPPORT # FIRMWARE WIDE HARDWARE SUPPORT
############################################################ ############################################################
@@ -63,7 +51,7 @@
hardware.cpu.amd.updateMicrocode = true; hardware.cpu.amd.updateMicrocode = true;
############################################################ ############################################################
# FILESYSTEMS USB ONLY # FILESYSTEMS BASED ON LABELS
############################################################ ############################################################
fileSystems."/" = { fileSystems."/" = {
@@ -76,29 +64,6 @@
fsType = "vfat"; 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 # NETWORKING
############################################################ ############################################################
@@ -194,6 +159,7 @@
#!/run/current-system/sw/bin/bash #!/run/current-system/sw/bin/bash
set -e set -e
# Ensure all system tools are available
export PATH="/run/current-system/sw/bin:/nix/var/nix/profiles/default/bin" 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" export NIX_PATH="nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixos"
@@ -203,31 +169,50 @@
if [ ! -d "$LOCAL_PATH/.git" ]; then if [ ! -d "$LOCAL_PATH/.git" ]; then
mkdir -p "$LOCAL_PATH" mkdir -p "$LOCAL_PATH"
chmod 700 "$LOCAL_PATH" chmod 700 "$LOCAL_PATH"
echo "Cloning config from $REPO_URL..."
git clone "$REPO_URL" "$LOCAL_PATH" git clone "$REPO_URL" "$LOCAL_PATH"
else else
cd "$LOCAL_PATH" cd "$LOCAL_PATH"
echo "Fetching updates..."
git fetch origin git fetch origin
LOCAL_HEAD=$(git rev-parse HEAD) LOCAL_HEAD=$(git rev-parse HEAD)
REMOTE_HEAD=$(git rev-parse origin/main) REMOTE_HEAD=$(git rev-parse origin/main)
if [ "$LOCAL_HEAD" != "$REMOTE_HEAD" ]; then if [ "$LOCAL_HEAD" != "$REMOTE_HEAD" ]; then
echo "New config available. Updating..."
git reset --hard origin/main git reset --hard origin/main
nixos-rebuild switch -I nixos-config="$LOCAL_PATH/configuration.nix" nixos-rebuild switch -I nixos-config="$LOCAL_PATH/configuration.nix"
echo "System updated successfully."
else
echo "Config is already up to date."
fi fi
fi fi
''; '';
environment.etc."update-nixos-config.sh".mode = "0700"; environment.etc."update-nixos-config.sh".mode = "0700";
systemd.services.nixos-git-update = { systemd.services.nixos-git-update = {
description = "Update NixOS from Git config"; description = "Update NixOS from public Git config";
script = "/etc/update-nixos-config.sh"; script = "/etc/update-nixos-config.sh";
serviceConfig.Type = "oneshot"; serviceConfig = {
Type = "oneshot";
User = "root";
Group = "root";
};
}; };
systemd.timers.nixos-git-update = { systemd.timers.nixos-git-update = {
description = "Check for config updates at startup";
wantedBy = [ "timers.target" ]; wantedBy = [ "timers.target" ];
timerConfig.OnBootSec = "60s"; timerConfig = {
OnBootSec = "60s";
};
}; };
############################################################
# USB OPTIMIZATIONS
############################################################
zramSwap.enable = true;
############################################################ ############################################################
# NIXOS VERSION # NIXOS VERSION
############################################################ ############################################################