Create new systemd-rebuild script to do the updating

This commit is contained in:
Lillian Violet 2024-03-01 15:19:24 +01:00
parent d98ca182e3
commit 8e3c5c5340
4 changed files with 29 additions and 1 deletions

View file

@ -104,8 +104,9 @@
pkgs.rebuild
pkgs.nix
pkgs.bash
pkgs.git
];
script = "bash /run/current-system/sw/bin/rebuild";
script = "bash /run/current-system/sw/bin/systemd-rebuild";
startAt = "daily";
};
};

View file

@ -19,6 +19,7 @@
# Custom tools
rebuild
install-nix
systemd-rebuild
# System tools
age

View file

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

View file

@ -0,0 +1,25 @@
{
lib,
stdenv,
writeShellApplication,
}:
writeShellApplication
{
name = "systemd-rebuild";
runtimeInputs = [];
text = ''
# A rebuild script for NixOS for use of the systemd service
cd /tmp
rm -rf ./rebuild
systemd-inhibit git clone https://git.lillianviolet.dev/Lillian-Violet/NixOS-Config.git ./rebuild
cd ./rebuild
echo "NixOS Rebuilding..."
systemd-inhibit sudo nixos-rebuild switch --flake .#
cd ..
echo "Cleaning up repository in '/tmp/rebuild'..."
systemd-inhibit rm -rf ./rebuild
echo "NixOS Rebuilt OK!"
'';
}