Inhibit trickery for the install command too

This commit is contained in:
Lillian Violet 2024-03-05 15:34:12 +01:00
parent 295d9bcc21
commit c6d12908cb
3 changed files with 39 additions and 22 deletions

View file

@ -6,5 +6,6 @@ pkgs: {
servo = pkgs.callPackage ./servo {}; servo = pkgs.callPackage ./servo {};
rebuild-no-inhibit = pkgs.callPackage ./rebuild-no-inhibit {}; rebuild-no-inhibit = pkgs.callPackage ./rebuild-no-inhibit {};
rebuild = pkgs.callPackage ./rebuild {}; rebuild = pkgs.callPackage ./rebuild {};
install-nix-no-inhibit = pkgs.callPackage ./install-nix-no-inhibit {};
install-nix = pkgs.callPackage ./install-nix {}; install-nix = pkgs.callPackage ./install-nix {};
} }

View file

@ -0,0 +1,36 @@
{
lib,
stdenv,
writeShellApplication,
}:
writeShellApplication
{
name = "install-nix-no-inhibit";
runtimeInputs = [];
text = ''
# An install script for NixOS installation to /tmp
set -e
pushd /tmp > /dev/null
systemd-inhibit --what=idle rm -rf ./install-nix
systemd-inhibit --what=idle git clone https://git.lillianviolet.dev/Lillian-Violet/NixOS-Config.git ./install-nix
pushd ./install-nix/nixos/hosts > /dev/null
echo "Please choose the hostname you are installing to from the following list:"
i=1
for d in */
do
dirs[i++]="''${d%/}"
done
select dir in "''${dirs[@]}"; do echo "you selected ''${dir}"; break; done
popd > /dev/null
pushd ./install-nix > /dev/null
echo "NixOS Installing..."
systemd-inhibit --what=idle sudo nixos-install --flake .#"''${dir}"
popd > /dev/null
echo "Cleaning up repository in '/tmp/install-nix'..."
systemd-inhibit --what=idle rm -rf ./install-nix
popd > /dev/null
echo "NixOS Install Succeeded!"
'';
}

View file

@ -10,27 +10,7 @@ writeShellApplication
runtimeInputs = []; runtimeInputs = [];
text = '' text = ''
# An install script for NixOS installation to /tmp # A rebuild script for NixOS
set -e sudo systemd-inhibit --who="NixOS Installer" --why="Installing NixOS to /mnt" install-nix-no-inhibit
pushd /tmp > /dev/null
systemd-inhibit --what=idle rm -rf ./install-nix
systemd-inhibit --what=idle git clone https://git.lillianviolet.dev/Lillian-Violet/NixOS-Config.git ./install-nix
pushd ./install-nix/nixos/hosts > /dev/null
echo "Please choose the hostname you are installing to from the following list:"
i=1
for d in */
do
dirs[i++]="''${d%/}"
done
select dir in "''${dirs[@]}"; do echo "you selected ''${dir}"; break; done
popd > /dev/null
pushd ./install-nix > /dev/null
echo "NixOS Installing..."
systemd-inhibit --what=idle sudo nixos-install --flake .#"''${dir}"
popd > /dev/null
echo "Cleaning up repository in '/tmp/install-nix'..."
systemd-inhibit --what=idle rm -rf ./install-nix
popd > /dev/null
notify-send -e "NixOS Install Succeeded!" --icon=software-update-available
''; '';
} }