2018-11-03 11:45:40 +01:00
_usage :
just -l
2018-11-03 11:03:03 +01:00
_device action dir +moreargs="" :
2018-10-30 13:38:36 +01:00
#!/usr/bin/env bash
2018-11-03 11:45:40 +01:00
set -ex
sudo $( set -x; nix-build --no-link --show-trace $( dirname { { dir} } ) /default.nix -A { { action} } --argstr dir { { dir} } { { moreargs} } )
2018-10-30 13:38:36 +01:00
2018-11-03 11:45:40 +01:00
_rebuild-device dir rebuildarg="dry-activate" +moreargs="" :
just -v _device rebuild { { dir} } --argstr rebuildarg { { rebuildarg} } { { moreargs} }
2018-10-30 13:38:36 +01:00
2018-11-03 11:03:03 +01:00
# Rebulid this device's NixOS
rebuild-this-device rebuildarg="dry-activate" :
just -v _rebuild-device nix/os/devices/$( hostname -s) { { rebuildarg} }
2018-10-30 13:38:36 +01:00
2018-11-03 11:45:40 +01:00
# This could be used to inject another channel
# --argstr moreargs "\'-I nixos-unstable=https://nixos.org/channels/nixos-unstable/nixexprs.tar.xz\'"
2018-11-03 11:03:03 +01:00
# Update nix-channels and switch to updated NixOS and home environments
update-this-device :
#!/usr/bin/env bash
2018-11-03 11:45:40 +01:00
export SYSUPDATE_LOG = .$( hostname -s) _sysupdate.log
export HOMEUPDATE_LOG = .$( hostname -s) _homeupdate.log
2018-11-03 11:03:03 +01:00
echo Updating system channels...
2018-11-03 11:45:40 +01:00
sudo nix-channel --update > ${ SYSUPDATE_LOG } 2>& 1
2018-11-03 11:03:03 +01:00
echo Updating system...
2018-11-03 11:45:40 +01:00
if just -v rebuild-this-device switch >> ${ SYSUPDATE_LOG } 2>& 1 ; then
2018-11-03 11:03:03 +01:00
echo System update successful
else
2018-11-03 11:45:40 +01:00
cat ${ SYSUPDATE_LOG }
echo System update failed
2018-11-03 11:03:03 +01:00
fi
if type home-manager > /dev/null 2>& 1; then
echo Updating home...
2018-11-03 11:45:40 +01:00
if home-manager -v switch > ${ HOMEUPDATE_LOG } 2>& 1 ; then
2018-11-03 11:03:03 +01:00
echo Home update successful
2018-11-03 11:45:40 +01:00
else
cat ${ HOMEUPDATE_LOG }
2018-11-03 11:03:03 +01:00
echo Home update failed
fi
fi
2018-11-03 18:43:22 +01:00
hm-iterate-qtile :
#!/usr/bin/env bash
set -xe
home-manager switch
Xephyr -ac -br -resizeable :1 &
XEPHYR_PID = $!
echo ${ XEPHYR_PID }
DISPLAY = :1 $( grep qtile ~/.xsession) &
wait $!
kill ${ XEPHYR_PID }
2018-11-03 11:03:03 +01:00
# 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} }