NixOS-Config/pkgs/update/default.nix

32 lines
661 B
Nix
Raw Normal View History

2024-03-12 14:42:33 +01:00
{
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
2024-03-12 14:53:54 +01:00
git clone forgejo@git.lillianviolet.dev:Lillian-Violet/NixOS-Config.git ./update
2024-03-12 14:42:33 +01:00
pushd ./update > /dev/null
echo "Updating flake lock..."
nix flake update
2024-03-12 14:50:19 +01:00
git add flake.lock
sudo nix flake check
2024-03-12 14:42:33 +01:00
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!"
'';
}