bin/hey: revise comments & refactor

This commit is contained in:
Henrik Lissner 2021-01-20 03:05:10 -05:00
parent 82ee5bef6a
commit 07f82da2a2

24
bin/hey
View file

@ -1,14 +1,17 @@
#!/usr/bin/env zsh #!/usr/bin/env zsh
# I don't believe the interface for Nix's utility scripts are very good. Guix's, # I don't like the user story for Nix's binaries, unlike Guix's. So I wrote
# on the other hand, is excellent. Management of your OS is done by a single # this to abstract away the unneeded complexity for everyday maintenance of my
# program with simpler, more intuitive commands. This script is a rudimentary # NixOS config.
# attempt at giving me that.
# #
# hey cd|check -> nix flake check $DOTFILES # hey cd|check
# hey sh|show -> nix flake show $DOTFILES # nix flake check $DOTFILES
# hey u|update -> nix flake update --recreate-lock-file $DOTFILES # hey sh|show
# hey re|rebuild -> nixos-rebuild --flake $DOTFILES#$HOST ${1:-build} # nix flake show $DOTFILES
# hey u|update [INPUT...]
# nix flake update --recreate-lock-file $DOTFILES
# hey re|rebuild [ARGS...]
# nixos-rebuild --flake $DOTFILES#$HOST ${@:-build}
# hey t|test -> nixos-rebuild --flake $DOTFILES#$HOST --fast test # hey t|test -> nixos-rebuild --flake $DOTFILES#$HOST --fast test
# hey theme $THEME -> THEME=$THEME hey test (quick theme swapping) # hey theme $THEME -> THEME=$THEME hey test (quick theme swapping)
# hey rollback -> hey rebuild --rollback switch # hey rollback -> hey rebuild --rollback switch
@ -22,7 +25,7 @@
# hey up|upgrade -> hey update && hey rebuild switch # hey up|upgrade -> hey update && hey rebuild switch
# hey gc -> GC user profile, optimise nix store # hey gc -> GC user profile, optimise nix store
# sudo hey gc -> GC, optimise nix store, & delete old boot entries # sudo hey gc -> GC, optimise nix store, & delete old boot entries
# hey push REMOTE -> push flake to remote (over SSH) and rebuild remotely # hey push REMOTE -> 1. Build machine locally, 2. Copy result to remote, 3. Activate config on remote
# hey gen|generations -> explore, manage, diff across generations (WIP) # hey gen|generations -> explore, manage, diff across generations (WIP)
# #
# hey (with no sub-command) can also be used as an alternative to nix-env: # hey (with no sub-command) can also be used as an alternative to nix-env:
@ -32,8 +35,7 @@
# hey -e htop # hey -e htop
set -e set -e
REMOTE=${REMOTE:-"~/.config/dotfiles"} DOTFILES=$(cd "${0:a:h}/.." && pwd -P)
DOTFILES="${0:a:h}/.."
# #
function main { function main {