Fix frajul-auto-upgrade git permission issue
This commit is contained in:
@@ -64,10 +64,7 @@ in {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo $$ > "$LOCK_FILE"
|
if /run/current-system/sw/bin/nix flake update --flake "${cfg.flakePath}" && /run/current-system/sw/bin/nixos-rebuild switch --flake "${cfg.flakePath}"; then
|
||||||
trap 'rm -f "$LOCK_FILE"' EXIT
|
|
||||||
|
|
||||||
if nix flake update --flake "${cfg.flakePath}" && nixos-rebuild switch --flake "${cfg.flakePath}"; then
|
|
||||||
echo "success" > "$LAST_STATUS_FILE"
|
echo "success" > "$LAST_STATUS_FILE"
|
||||||
else
|
else
|
||||||
echo "failure" > "$LAST_STATUS_FILE"
|
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 = {
|
systemd.services.frajul-auto-upgrade = {
|
||||||
description = "Frajul's NixOS Auto Upgrade";
|
description = "Frajul's NixOS Auto Upgrade";
|
||||||
after = ["network-online.target"];
|
after = ["network-online.target"];
|
||||||
|
wants = ["network-online.target"];
|
||||||
restartIfChanged = false; # Do not start service on nixos switch
|
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 = {
|
serviceConfig = {
|
||||||
Type = "oneshot";
|
Type = "oneshot";
|
||||||
User = cfg.user;
|
User = cfg.user;
|
||||||
|
Reference in New Issue
Block a user