Simplified rebuild and made it only need one password entry
This commit is contained in:
parent
42a5093c25
commit
23e99a1c40
|
@ -18,6 +18,7 @@
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
# Custom tools
|
# Custom tools
|
||||||
rebuild
|
rebuild
|
||||||
|
rebuild-no-inhibit
|
||||||
install-nix
|
install-nix
|
||||||
|
|
||||||
# System tools
|
# System tools
|
||||||
|
|
|
@ -4,6 +4,7 @@ pkgs: {
|
||||||
dvd = pkgs.callPackage ./dvd {};
|
dvd = pkgs.callPackage ./dvd {};
|
||||||
dvt = pkgs.callPackage ./dvt {};
|
dvt = pkgs.callPackage ./dvt {};
|
||||||
servo = pkgs.callPackage ./servo {};
|
servo = pkgs.callPackage ./servo {};
|
||||||
|
rebuild-no-inhibit = pkgs.callPackage ./rebuild-no-inhibit {};
|
||||||
rebuild = pkgs.callPackage ./rebuild {};
|
rebuild = pkgs.callPackage ./rebuild {};
|
||||||
install-nix = pkgs.callPackage ./install-nix {};
|
install-nix = pkgs.callPackage ./install-nix {};
|
||||||
}
|
}
|
||||||
|
|
28
pkgs/rebuild-no-inhibit/default.nix
Normal file
28
pkgs/rebuild-no-inhibit/default.nix
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
stdenv,
|
||||||
|
writeShellApplication,
|
||||||
|
}:
|
||||||
|
writeShellApplication
|
||||||
|
{
|
||||||
|
name = "rebuild-no-inhibit";
|
||||||
|
|
||||||
|
runtimeInputs = [];
|
||||||
|
|
||||||
|
text = ''
|
||||||
|
# A rebuild script for NixOS
|
||||||
|
|
||||||
|
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!"
|
||||||
|
'';
|
||||||
|
}
|
|
@ -11,21 +11,6 @@ writeShellApplication
|
||||||
|
|
||||||
text = ''
|
text = ''
|
||||||
# A rebuild script for NixOS
|
# A rebuild script for NixOS
|
||||||
rebuild_function () {
|
sudo systemd-inhibit --who="NixOS Updater" --why="Updating system configuration" rebuild-no-inhibit"
|
||||||
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!"
|
|
||||||
}
|
|
||||||
|
|
||||||
sudo systemd-inhibit --who="NixOS Updater" --why="Updating system configuration" sudo -u lillian bash -c "$(declare -f rebuild_function); rebuild_function"
|
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue