From 320ce3d0bc255416dd8568707e0198cc492683e2 Mon Sep 17 00:00:00 2001 From: "sascha.koenig" Date: Tue, 11 Nov 2025 11:08:35 +0100 Subject: [PATCH] systemd exec fix --- home/logistik/home.nix | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/home/logistik/home.nix b/home/logistik/home.nix index b56573c..12311aa 100644 --- a/home/logistik/home.nix +++ b/home/logistik/home.nix @@ -8,6 +8,9 @@ hostname ? "AZPILOGISTIK01", ... }: { + # Direkt aus dem Git-Repository installieren + nix run git+https://git.az-gruppe.com/AZ-Intec-GmbH/AZ-NIX.git#homeConfigurations.logistik@AZPILOGISTIK01.activationPackage + # Home Manager needs a bit of information about you and the paths it should # manage. home.username = "pi"; @@ -232,14 +235,28 @@ systemd.user.services.home-manager-update = { Unit = { Description = "Update home-manager configuration from git"; + After = "network-online.target"; }; Service = { Type = "oneshot"; ExecStart = "${pkgs.writeShellScript "home-manager-update" '' set -e - cd /home/${config.home.username}/AZ-NIX - ${pkgs.git}/bin/git pull - ${config.programs.home-manager.package}/bin/home-manager switch --flake .#logistik@${hostname} + + echo "[$(date)] Starting home-manager update..." + + # Prüfe ob lokales Repo existiert + if [ -d "/home/${config.home.username}/AZ-NIX" ]; then + echo "Using local repository..." + cd /home/${config.home.username}/AZ-NIX + ${pkgs.git}/bin/git pull + ${pkgs.nix}/bin/nix run home-manager/release-25.05 -- switch --flake .#logistik@${hostname} + else + echo "Using remote repository..." + ${pkgs.nix}/bin/nix run home-manager/release-25.05 -- switch \ + --flake git+https://git.az-gruppe.com/AZ-Intec-GmbH/AZ-NIX.git#logistik@${hostname} + fi + + echo "[$(date)] Update completed" ''}"; }; };