Add update and upgrade commands
This commit is contained in:
parent
50f21e221a
commit
74eb3db41a
29
pkgs/update/default.nix
Normal file
29
pkgs/update/default.nix
Normal file
|
@ -0,0 +1,29 @@
|
|||
{
|
||||
lib,
|
||||
stdenv,
|
||||
writeShellApplication,
|
||||
}:
|
||||
writeShellApplication
|
||||
{
|
||||
name = "update";
|
||||
|
||||
runtimeInputs = [];
|
||||
|
||||
text = ''
|
||||
# A script to update the flake lock for NixOS
|
||||
set -e
|
||||
pushd /tmp > /dev/null
|
||||
rm -rf ./update
|
||||
git clone https://git.lillianviolet.dev/Lillian-Violet/NixOS-Config.git ./update
|
||||
pushd ./update > /dev/null
|
||||
echo "Updating flake lock..."
|
||||
nix flake update
|
||||
git commit -m "update flake lock"
|
||||
git push
|
||||
popd > /dev/null
|
||||
echo "Cleaning up repository in '/tmp/update'..."
|
||||
rm -rf ./update
|
||||
popd > /dev/null
|
||||
echo "Flake lock update OK!"
|
||||
'';
|
||||
}
|
17
pkgs/upgrade/default.nix
Normal file
17
pkgs/upgrade/default.nix
Normal file
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
lib,
|
||||
stdenv,
|
||||
writeShellApplication,
|
||||
}:
|
||||
writeShellApplication
|
||||
{
|
||||
name = "rebuild";
|
||||
|
||||
runtimeInputs = [];
|
||||
|
||||
text = ''
|
||||
# An upgrade script for nixos
|
||||
sudo systemd-inhibit --who="NixOS Updater" --why="Updating flake lock" update
|
||||
sudo systemd-inhibit --who="NixOS Updater" --why="Updating system configuration" rebuild-no-inhibit
|
||||
'';
|
||||
}
|
Loading…
Reference in a new issue