Make rebuild a bit cleaner with sudo
This commit is contained in:
parent
ace01f3391
commit
f8cf7b589b
|
@ -11,17 +11,20 @@ writeShellApplication
|
||||||
|
|
||||||
text = ''
|
text = ''
|
||||||
# A rebuild script for NixOS
|
# A rebuild script for NixOS
|
||||||
|
rebuild_function (){
|
||||||
set -e
|
set -e
|
||||||
pushd /tmp > /dev/null
|
pushd /tmp > /dev/null
|
||||||
rm -rf ./rebuild
|
rm -rf ./rebuild
|
||||||
systemd-inhibit --what=idle git clone https://git.lillianviolet.dev/Lillian-Violet/NixOS-Config.git ./rebuild
|
git clone https://git.lillianviolet.dev/Lillian-Violet/NixOS-Config.git ./rebuild
|
||||||
pushd ./rebuild > /dev/null
|
pushd ./rebuild > /dev/null
|
||||||
echo "NixOS Rebuilding..."
|
echo "NixOS Rebuilding..."
|
||||||
systemd-inhibit --what=idle sudo nixos-rebuild switch --flake .#
|
sudo nixos-rebuild switch --flake .#
|
||||||
popd > /dev/null
|
popd > /dev/null
|
||||||
echo "Cleaning up repository in '/tmp/rebuild'..."
|
echo "Cleaning up repository in '/tmp/rebuild'..."
|
||||||
systemd-inhibit --what=idle rm -rf ./rebuild
|
rm -rf ./rebuild
|
||||||
popd > /dev/null
|
popd > /dev/null
|
||||||
echo "NixOS Rebuilt OK!"
|
echo "NixOS Rebuilt OK!"
|
||||||
|
}
|
||||||
|
sudo systemd-inhibit --who="NixOS Updater" --why="Updating system configuration" sudo -u lillian rebuild_function
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue