From 160318776c6ccc411488908a9d48ec60b490060a Mon Sep 17 00:00:00 2001 From: ska Date: Thu, 25 Dec 2025 22:43:47 +0000 Subject: [PATCH] Update configuration.nix --- configuration.nix | 55 +---------------------------------------------- 1 file changed, 1 insertion(+), 54 deletions(-) diff --git a/configuration.nix b/configuration.nix index 124c1f0..49ddeab 100644 --- a/configuration.nix +++ b/configuration.nix @@ -3,6 +3,7 @@ { imports = [ ./flatpak.nix + ./git-auto-update.nix ]; ############################################################ @@ -187,60 +188,6 @@ services.flatpak.enable = true; - ############################################################ - # GIT AUTO-UPDATE SCRIPT - ############################################################ - - environment.etc."update-nixos-config.sh".text = '' - #!/run/current-system/sw/bin/bash - set -e - - 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" - - LOCAL_PATH="/var/lib/nixos-config" - REPO_URL="https://git.skarockoi.de/ska/nixos-production.git " - - if [ ! -d "$LOCAL_PATH/.git" ]; then - mkdir -p "$LOCAL_PATH" - chmod 700 "$LOCAL_PATH" - git clone "$REPO_URL" "$LOCAL_PATH" - else - cd "$LOCAL_PATH" - git fetch origin - LOCAL_HEAD=$(git rev-parse HEAD) - REMOTE_HEAD=$(git rev-parse origin/main) - if [ "$LOCAL_HEAD" != "$REMOTE_HEAD" ]; then - git reset --hard origin/main - nixos-rebuild boot -I nixos-config="$LOCAL_PATH/configuration.nix" - fi - fi - ''; - environment.etc."update-nixos-config.sh".mode = "0700"; - - systemd.services.nixos-git-update = { - description = "Update NixOS from public Git config"; - script = "/etc/update-nixos-config.sh"; - serviceConfig = { - Type = "oneshot"; - User = "root"; - Group = "root"; - TimeoutStartSec = "10min"; - Restart = "on-failure"; - StandardOutput = "journal"; - StandardError = "journal"; - }; - }; - - systemd.timers.nixos-git-update = { - description = "Check for config updates at startup"; - wantedBy = [ "timers.target" ]; - timerConfig = { - OnBootSec = "60s"; - OnUnitActiveSec = "5min"; - }; - }; - ############################################################ # USB OPTIMIZATIONS ############################################################