NixOS-Config/pkgs/rebuild/default.nix

28 lines
648 B
Nix
Raw Normal View History

2024-02-26 14:17:34 +01:00
{
lib,
stdenv,
writeShellApplication,
}:
writeShellApplication
{
name = "rebuild";
runtimeInputs = [];
text = ''
# A rebuild script for NixOS
set -e
pushd /tmp > /dev/null
rm -rf ./rebuild
systemd-inhibit --what=idle git clone https://git.lillianviolet.dev/Lillian-Violet/NixOS-Config.git ./rebuild
pushd ./rebuild > /dev/null
2024-02-26 14:17:34 +01:00
echo "NixOS Rebuilding..."
systemd-inhibit --what=idle sudo nixos-rebuild switch --flake .#
popd > /dev/null
echo "Cleaning up repository in '/tmp/rebuild'..."
systemd-inhibit --what=idle rm -rf ./rebuild
popd > /dev/null
2024-03-01 15:10:51 +01:00
echo "NixOS Rebuilt OK!"
2024-02-26 14:17:34 +01:00
'';
}