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:
|
||||
|
|
10
nix/os/devices/steveej-t480s-work/versions.tmpl.nix
Normal file
10
nix/os/devices/steveej-t480s-work/versions.tmpl.nix
Normal 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' -%>";
|
||||
};
|
||||
}
|
|
@ -18,6 +18,8 @@ stdenv.mkDerivation {
|
|||
vncdo
|
||||
tesseract
|
||||
imagemagick
|
||||
|
||||
esh
|
||||
];
|
||||
|
||||
# Set Environment Variables
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue