default:
  @just --list

defhost := `hostname`
defuser := env_var('USER')

alias dh := deployhome
[group('home')]
deployhome user=defuser host=defhost:
  nh home switch -c {{user}}@{{host}} -b bak .

[group('home')]
refreshhome user=defuser host=defhost:
  nh home switch -c {{user}}@{{host}} -b bak . -- --refresh

alias do := deployos
[group('nixos')]
deployos host=defhost:
  nh os switch -H {{host}} .

alias dd := deploydarwin
[group('darwin')]
deploydarwin host=defhost:
  darwin-rebuild switch --flake .#{{host}}

alias up := update
[group('update')]
update:
  nix flake update

[group('update')]
updatejust this:
  nix flake update {{this}}

alias gc := collectgarbage
[group('maintainence')]
collectgarbage:
  nh clean all

[group('maintainence')]
genFirefoxAddons:
  nix run git+https://git.sr.ht/~rycee/mozilla-addons-to-nix/ -- \
  overlays/firefox-addons/addons.json \
  overlays/firefox-addons/addons.nix

alias s := search
search this:
  nh search {{this}}