executable_dotfiles 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. #!/usr/bin/env bash
  2. exec &> >(tee "${XDG_CACHE_HOME:-$HOME/.cache}/dotfiles.log")
  3. case "$1" in
  4. guix)
  5. exec -a chezmoi chezmoi --source @GUIX@ --color="${COLOR:-on}" "${@:2}"
  6. ;;
  7. pull)
  8. guix pull --channels="@GUIX@/dotfiles/channels.scm"
  9. sudo --login guix pull --channels="@GUIX@/dotfiles/channels.scm"
  10. nix-channel --update
  11. ;;
  12. reconfigure)
  13. chezmoi --source "@GUIX@" apply
  14. guix package --manifest="@GUIX@/dotfiles/manifests/$HOSTNAME.scm"
  15. sudo --login guix system reconfigure "@GUIX@/dotfiles/guixsd/$HOSTNAME.scm"
  16. NIX_PATH=nixpkgs="$HOME/.nix-defexpr/channels/nixos-unstable" nix-env --install '.*' -f "$HOME/manifest.nix"
  17. ;;
  18. template)
  19. exec -a chezmoi chezmoi add --template --autotemplate "$@"
  20. ;;
  21. bin)
  22. diff --unified \
  23. <(for file in "$HOME"/bin/*; do basename "$file"; done) \
  24. <(for file in "$HOME"/.local/share/chezmoi/bin/*; do basename "$file" | sed 's@executable_@@'; done)
  25. ;;
  26. *)
  27. exec -a chezmoi chezmoi "$@"
  28. ;;
  29. esac