Justfile: move rebuild functionality into rebuild
This commit is contained in:
parent
9d9862816a
commit
220685dd9a
1 changed files with 38 additions and 21 deletions
59
Justfile
59
Justfile
|
@ -12,7 +12,40 @@ _rebuild-device dir rebuildarg="dry-activate" +moreargs="":
|
||||||
|
|
||||||
# Rebulid this device's NixOS
|
# Rebulid this device's NixOS
|
||||||
rebuild-this-device rebuildarg="dry-activate":
|
rebuild-this-device rebuildarg="dry-activate":
|
||||||
just -v _rebuild-device nix/os/devices/$(hostname -s) {{rebuildarg}}
|
#!/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
|
# This could be used to inject another channel
|
||||||
# --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\'"
|
||||||
|
@ -21,28 +54,12 @@ rebuild-this-device rebuildarg="dry-activate":
|
||||||
# Update nix-channels and switch to updated NixOS and home environments
|
# Update nix-channels and switch to updated NixOS and home environments
|
||||||
update-this-device:
|
update-this-device:
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
export SYSUPDATE_LOG=.$(hostname -s)_sysupdate.log
|
set -e
|
||||||
export HOMEUPDATE_LOG=.$(hostname -s)_homeupdate.log
|
export SYSREBUILD_LOG=.$(hostname -s)_sysrebuild.log
|
||||||
|
|
||||||
echo Updating system channels...
|
echo Updating system channels...
|
||||||
sudo nix-channel --update > ${SYSUPDATE_LOG} 2>&1
|
sudo nix-channel --update
|
||||||
echo Updating system...
|
just -v rebuild-this-device switch
|
||||||
if just -v rebuild-this-device switch >> ${SYSUPDATE_LOG} 2>&1 ; then
|
|
||||||
echo System update successful
|
|
||||||
else
|
|
||||||
cat ${SYSUPDATE_LOG}
|
|
||||||
echo System update failed
|
|
||||||
fi
|
|
||||||
|
|
||||||
if type home-manager > /dev/null 2>&1; then
|
|
||||||
echo Updating home...
|
|
||||||
if home-manager -v switch > ${HOMEUPDATE_LOG} 2>&1 ; then
|
|
||||||
echo Home update successful
|
|
||||||
else
|
|
||||||
cat ${HOMEUPDATE_LOG}
|
|
||||||
echo Home update failed
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
hm-iterate-qtile:
|
hm-iterate-qtile:
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue