90 lines
2.7 KiB
Makefile
Executable file
90 lines
2.7 KiB
Makefile
Executable file
_usage:
|
|
just -l
|
|
|
|
_device action dir +moreargs="":
|
|
#!/usr/bin/env bash
|
|
set -ex
|
|
sudo $(set -x; nix-build --no-link --show-trace $(dirname {{dir}})/default.nix -A {{action}} --argstr dir {{dir}} {{moreargs}})
|
|
|
|
_rebuild-device dir rebuildarg="dry-activate" +moreargs="":
|
|
#!/usr/bin/env bash
|
|
nix/scripts/pre-eval-fixed.sh nix/home-manager/profiles/dotfiles/vcsh{.tmpl,}.nix
|
|
just -v _device rebuild {{dir}} --argstr rebuildarg {{rebuildarg}} {{moreargs}}
|
|
|
|
# Rebulid this device's NixOS
|
|
rebuild-this-device rebuildarg="dry-activate":
|
|
#!/usr/bin/env bash
|
|
set -e
|
|
|
|
function parse_hm_rebuildarg() {
|
|
case $1 in
|
|
switch)
|
|
echo switch
|
|
;;
|
|
*)
|
|
echo build
|
|
;;
|
|
esac
|
|
}
|
|
|
|
export SYSREBUILD_LOG=.$(hostname -s)_sysrebuild.log
|
|
export HOMEREBUILD_LOG=.$(hostname -s)_homerebuild.log
|
|
|
|
echo Rebuilding system in {{rebuildarg}}-mode...
|
|
if just -v _rebuild-device nix/os/devices/$(hostname -s) {{rebuildarg}} > ${SYSREBUILD_LOG} 2>&1 ; then
|
|
echo System rebuild successful
|
|
else
|
|
cat ${SYSREBUILD_LOG}
|
|
echo System rebuild failed
|
|
fi
|
|
|
|
if type home-manager > /dev/null 2>&1; then
|
|
echo Rebuilding home in $(parse_hm_rebuildarg {{rebuildarg}})-mode...
|
|
if home-manager -v $(parse_hm_rebuildarg {{rebuildarg}}) > ${HOMEREBUILD_LOG} 2>&1 ; then
|
|
echo Home rebuild successful
|
|
else
|
|
cat ${HOMEREBUILD_LOG}
|
|
echo Home rebuild failed
|
|
fi
|
|
fi
|
|
|
|
# This could be used to inject another channel
|
|
# --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:
|
|
#!/usr/bin/env bash
|
|
set -e
|
|
export SYSREBUILD_LOG=.$(hostname -s)_sysrebuild.log
|
|
|
|
echo Updating system channels...
|
|
sudo nix-channel --update
|
|
just -v rebuild-this-device switch
|
|
|
|
hm-iterate-qtile:
|
|
#!/usr/bin/env bash
|
|
set -xe
|
|
home-manager switch || just -v rebuild-this-device switch
|
|
Xephyr -ac -br -resizeable :1 &
|
|
XEPHYR_PID=$!
|
|
echo ${XEPHYR_PID}
|
|
DISPLAY=:1 $(grep qtile ~/.xsession) &
|
|
wait $!
|
|
kill ${XEPHYR_PID}
|
|
|
|
# !!! DANGERIOUS !!! This wipes the disk which is configured for the given device.
|
|
disk-prepare dir:
|
|
just -v _device diskPrepare {{dir}} --argstr rebuildarg "dummy"
|
|
|
|
# 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}} --argstr rebuildarg "dummy"
|
|
|
|
# Unmount target disk, specified by device configuration directory
|
|
disk-umount dir:
|
|
just -v _device diskUmount {{dir}} --argstr rebuildarg "dummy"
|
|
|
|
# Perform an offline installation on the mounted target disk, specified by device configuration directory
|
|
disk-install dir:
|
|
just -v _device diskInstall {{dir}} --argstr rebuildarg "dummy"
|