small improvements to auto update script

This commit is contained in:
Aleksandr Lebedev 2024-12-18 11:42:28 +01:00
parent a7b2867a0b
commit 376b6bc1cf
2 changed files with 45 additions and 45 deletions

View file

@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/bin/sh
# Wrapper script for nixos-rebuild
# Configuration parameters
@ -73,11 +73,11 @@ fi
cd $flakeDir
echo "Pulling the latest version of the repository..."
/run/wrappers/bin/sudo -u $user git pull
/run/wrappers/bin/sudo -u $user /run/current-system/sw/bin/git pull
if [ $update = true ]; then
echo "Updating flake.lock..."
/run/wrappers/bin/sudo -u $user nix flake update --commit-lock-file && /run/wrappers/bin/sudo -u $user git push
/run/wrappers/bin/sudo -u $user /run/current-system/sw/bin/nix flake update --commit-lock-file && /run/wrappers/bin/sudo -u $user /run/current-system/sw/bin/git push
else
echo "Skipping 'nix flake update'..."
fi