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
# I don't believe the interface for Nix's utility scripts are very good. Guix's,
# on the other hand, is excellent. Management of your OS is done by a single
# program with simpler, more intuitive commands. This script is a rudimentary
# attempt at giving me that.
# I don't like the user story for Nix's binaries, unlike Guix's. So I wrote
# this to abstract away the unneeded complexity for everyday maintenance of my
# NixOS config.
#
# hey cd|check -> nix flake check $DOTFILES
# hey sh|show -> nix flake show $DOTFILES
# hey u|update -> nix flake update --recreate-lock-file $DOTFILES
# hey re|rebuild -> nixos-rebuild --flake $DOTFILES#$HOST ${1:-build}
# hey cd|check
# nix flake check $DOTFILES
# hey sh|show
# 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 theme $THEME -> THEME=$THEME hey test (quick theme swapping)
# hey rollback -> hey rebuild --rollback switch
@ -22,7 +25,7 @@
# hey up|upgrade -> hey update && hey rebuild switch
# hey gc -> GC user profile, optimise nix store
# 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 (with no sub-command) can also be used as an alternative to nix-env:
@ -32,8 +35,7 @@
# hey -e htop
set -e
REMOTE=${REMOTE:-"~/.config/dotfiles"}
DOTFILES="${0:a:h}/.."
DOTFILES=$(cd "${0:a:h}/.." && pwd -P)
#
function main {