nix config udpate; polish top-level Justfile

This commit is contained in:
steveej 2018-11-03 11:03:03 +01:00
parent 0e2f704aa3
commit 239c2c9c44
8 changed files with 81 additions and 37 deletions

View file

@ -1,16 +1,49 @@
devices action dir +moreargs="":
_device action dir +moreargs="":
#!/usr/bin/env bash
set -x
set -e
sudo $(nix-build --no-link --show-trace $(dirname {{dir}})/default.nix -A {{action}} --argstr dir {{dir}} {{moreargs}} )
diskMount dir:
just -v devices diskMount {{dir}}
diskUmount dir:
just -v devices diskUmount {{dir}}
_rebuild-device dir rebuildarg="dry-activate":
just -v _device rebuild {{dir}} --argstr rebuildarg {{rebuildarg}}
diskInstall dir:
just -v devices diskInstall {{dir}}
# Rebulid this device's NixOS
rebuild-this-device rebuildarg="dry-activate":
just -v _rebuild-device nix/os/devices/$(hostname -s) {{rebuildarg}}
device-rebuild dir rebuildarg="build":
just -v devices rebuild {{dir}} --argstr rebuildarg {{rebuildarg}}
# Update nix-channels and switch to updated NixOS and home environments
update-this-device:
#!/usr/bin/env bash
echo Updating system channels...
sudo nix-channel --update > .$(hostname -s)_sysupdate.log 2>&1
echo Updating system...
if just -v rebuild-this-device >> .$(hostname -s)_sysupdate.log 2>&1 ; then
echo System update successful
else
System update failed
fi
if type home-manager > /dev/null 2>&1; then
echo Updating home...
if home-manager -v switch > .$(hostname -s)_homeupdate.log 2>&1 ; then
echo Home update successful
else
echo Home update failed
fi
fi
# Sorry, this is a manual step for now. Please see nix/os/modules/encryptedDisk.nix for the layout
disk-prepare:
echo NOT IMPLEMENTED
# Mount the target disk specified by device configuration directory. The 'dir' argument points to a device configuration, e.g. 'nix/os/devices/steveej-live-mmc-SL32G_0x259093f6'
disk-mount dir:
just -v _device diskMount {{dir}}
# Unmount target disk, specified by device configuration directory
disk-umount dir:
just -v _device diskUmount {{dir}}
# Perform an offline installation on the mounted the target disk, specified by device configuration directory
disk-install dir:
just -v _device diskInstall {{dir}}