fix(nixos): add safe.directory for dotfiles-rebuild service 🔧

Git refuses to operate on /etc/dotfiles owned by danny when the
service runs as root. Pass safe.directory via environment variables.
This commit is contained in:
DannyDannyDanny 2026-03-30 14:20:31 +02:00
parent afbc87be2b
commit d8e5cbe26a

View file

@ -67,6 +67,9 @@ in
systemd.services.dotfiles-rebuild = { systemd.services.dotfiles-rebuild = {
description = "Pull dotfiles and run nixos-rebuild if repo changed"; description = "Pull dotfiles and run nixos-rebuild if repo changed";
path = with pkgs; [ git nix ]; path = with pkgs; [ git nix ];
environment.GIT_CONFIG_COUNT = "1";
environment.GIT_CONFIG_KEY_0 = "safe.directory";
environment.GIT_CONFIG_VALUE_0 = dotfilesDir;
script = '' script = ''
set -euo pipefail set -euo pipefail
cd ${dotfilesDir} cd ${dotfilesDir}