Fix frajul-auto-upgrade git permission issue
This commit is contained in:
@@ -64,10 +64,7 @@ in {
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo $$ > "$LOCK_FILE"
|
||||
trap 'rm -f "$LOCK_FILE"' EXIT
|
||||
|
||||
if nix flake update --flake "${cfg.flakePath}" && nixos-rebuild switch --flake "${cfg.flakePath}"; then
|
||||
if /run/current-system/sw/bin/nix flake update --flake "${cfg.flakePath}" && /run/current-system/sw/bin/nixos-rebuild switch --flake "${cfg.flakePath}"; then
|
||||
echo "success" > "$LAST_STATUS_FILE"
|
||||
else
|
||||
echo "failure" > "$LAST_STATUS_FILE"
|
||||
@@ -131,10 +128,28 @@ in {
|
||||
'')
|
||||
];
|
||||
|
||||
# Fixes error: repository path '...' is not owned by current user
|
||||
environment.etc."root/.gitconfig".text = ''
|
||||
[safe]
|
||||
directory = ${cfg.flakePath}
|
||||
'';
|
||||
|
||||
systemd.services.frajul-auto-upgrade = {
|
||||
description = "Frajul's NixOS Auto Upgrade";
|
||||
after = ["network-online.target"];
|
||||
wants = ["network-online.target"];
|
||||
restartIfChanged = false; # Do not start service on nixos switch
|
||||
|
||||
path = with pkgs; [
|
||||
coreutils
|
||||
gnutar
|
||||
xz.bin
|
||||
gzip
|
||||
gitMinimal
|
||||
config.nix.package.out
|
||||
config.programs.ssh.package
|
||||
];
|
||||
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
User = cfg.user;
|
||||
|
Reference in New Issue
Block a user