From 7d3f467586f6d8967f13cee96e9cfa4c9626d486 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Felix=20Schr=C3=B6ter?= <dev@felschr.com>
Date: Sun, 8 Jun 2025 22:58:04 +0200
Subject: [PATCH] fix(system): ignore seven-modules in nixos-upgrade's flake
 updates

Prevents nixos-upgrade from failing due to interactive git authorization.
---
 system/nix.nix | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/system/nix.nix b/system/nix.nix
index c2616d7..e77734a 100644
--- a/system/nix.nix
+++ b/system/nix.nix
@@ -2,6 +2,7 @@
   inputs,
   config,
   pkgs,
+  lib,
   ...
 }:
 
@@ -37,7 +38,16 @@ in
     config.safe.directory = [ "/etc/nixos" ];
   };
 
-  systemd.services.nixos-upgrade.preStart = ''
-    nix flake update --flake ${config.system.autoUpgrade.flake}
-  '';
+  systemd.services.nixos-upgrade.preStart =
+    let
+      inputsToIgnore = [
+        "self"
+        "seven-modules"
+      ];
+      inputsToUpdate = lib.filter (i: !(lib.elem i inputsToIgnore)) (lib.attrNames inputs);
+      inputsToUpdateStr = lib.concatStringsSep " " inputsToUpdate;
+    in
+    ''
+      nix flake update ${inputsToUpdateStr} --flake ${config.system.autoUpgrade.flake}
+    '';
 }