2024-02-26 14:17:34 +01:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
stdenv,
|
|
|
|
writeShellApplication,
|
|
|
|
}:
|
|
|
|
writeShellApplication
|
|
|
|
{
|
|
|
|
name = "rebuild";
|
|
|
|
|
|
|
|
runtimeInputs = [];
|
|
|
|
|
|
|
|
text = ''
|
|
|
|
# A rebuild script for NixOS
|
2024-03-01 16:34:55 +01:00
|
|
|
rebuild_function () {
|
2024-03-01 16:27:48 +01:00
|
|
|
set -e
|
|
|
|
pushd /tmp > /dev/null
|
|
|
|
rm -rf ./rebuild
|
|
|
|
git clone https://git.lillianviolet.dev/Lillian-Violet/NixOS-Config.git ./rebuild
|
|
|
|
pushd ./rebuild > /dev/null
|
|
|
|
echo "NixOS Rebuilding..."
|
|
|
|
sudo nixos-rebuild switch --flake .#
|
|
|
|
popd > /dev/null
|
|
|
|
echo "Cleaning up repository in '/tmp/rebuild'..."
|
|
|
|
rm -rf ./rebuild
|
|
|
|
popd > /dev/null
|
|
|
|
echo "NixOS Rebuilt OK!"
|
|
|
|
}
|
2024-03-01 16:34:55 +01:00
|
|
|
sudo bash -c "$(declare -f rebuild_function); rebuild_function"
|
2024-03-01 16:27:48 +01:00
|
|
|
sudo systemd-inhibit --who="NixOS Updater" --why="Updating system configuration" sudo -u lillian rebuild_function
|
2024-02-26 14:17:34 +01:00
|
|
|
'';
|
|
|
|
}
|