nix: add semi-automatic update process

This commit is contained in:
steveej 2019-01-17 22:35:19 +01:00
parent 714a310e72
commit 7ab7c8be30
3 changed files with 36 additions and 7 deletions

View file

@ -68,15 +68,32 @@ rebuild-this-device rebuildarg="dry-activate":
# --argstr moreargs "\'-I nixos-unstable=https://nixos.org/channels/nixos-unstable/nixexprs.tar.xz\'" # --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 the channel versions and (by default) switch to new environment
update-this-device: update-this-device rebuild-mode='switch':
#!/usr/bin/env bash #!/usr/bin/env bash
set -e set -xe
export SYSREBUILD_LOG=.$(hostname -s)_sysrebuild.log
echo Updating system channels... template=nix/os/devices/$(hostname -s)/versions.tmpl.nix
sudo nix-channel --update outfile=nix/os/devices/$(hostname -s)/versions.nix
just -v rebuild-this-device switch
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) # Iterate on a qtile config by running it inside Xephyr. (un-/grab the mouse with Ctrl + Shift-L)
hm-iterate-qtile: hm-iterate-qtile:

View file

@ -0,0 +1,10 @@
{
channelsNixosStable = {
ref = "nixos-18.09";
rev = "<% git ls-remote https://github.com/nixos/nixpkgs-channels nixos-18.09 | awk '{ print $1 }' | tr -d '\n' -%>";
};
channelsNixosUnstable = {
ref = "nixos-unstable";
rev = "<% git ls-remote https://github.com/nixos/nixpkgs-channels nixos-unstable | awk '{ print $1 }' | tr -d '\n' -%>";
};
}

View file

@ -18,6 +18,8 @@ stdenv.mkDerivation {
vncdo vncdo
tesseract tesseract
imagemagick imagemagick
esh
]; ];
# Set Environment Variables # Set Environment Variables