nix: add semi-automatic update process
This commit is contained in:
parent
714a310e72
commit
7ab7c8be30
3 changed files with 36 additions and 7 deletions
31
Justfile
31
Justfile
|
@ -68,15 +68,32 @@ rebuild-this-device rebuildarg="dry-activate":
|
|||
# --argstr moreargs "\'-I nixos-unstable=https://nixos.org/channels/nixos-unstable/nixexprs.tar.xz\'"
|
||||
|
||||
|
||||
# Update nix-channels and switch to updated NixOS and home environments
|
||||
update-this-device:
|
||||
# Update the channel versions and (by default) switch to new environment
|
||||
update-this-device rebuild-mode='switch':
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
export SYSREBUILD_LOG=.$(hostname -s)_sysrebuild.log
|
||||
set -xe
|
||||
|
||||
echo Updating system channels...
|
||||
sudo nix-channel --update
|
||||
just -v rebuild-this-device switch
|
||||
template=nix/os/devices/$(hostname -s)/versions.tmpl.nix
|
||||
outfile=nix/os/devices/$(hostname -s)/versions.nix
|
||||
|
||||
esh -o ${outfile} ${template}
|
||||
if ! test "$(git diff ${outfile})"; then
|
||||
echo Already on latest versions
|
||||
exit 0
|
||||
fi
|
||||
|
||||
export SYSREBUILD_LOG=.$(hostname -s)_sysrebuild.log
|
||||
just -v rebuild-this-device dry-activate || {
|
||||
echo ERROR: Update failed, reverting ${outfile}...
|
||||
git checkout ${outfile}
|
||||
exit 1
|
||||
}
|
||||
|
||||
git commit -v ${outfile} -m "nix/os/devices/$(hostname -s): bump versions"
|
||||
|
||||
just -v rebuild-this-device {{rebuild-mode}} || {
|
||||
echo WARNING: Rebuilding in {{rebuild-mode}}-mode failed
|
||||
}
|
||||
|
||||
# Iterate on a qtile config by running it inside Xephyr. (un-/grab the mouse with Ctrl + Shift-L)
|
||||
hm-iterate-qtile:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue