1{ config, ... }:
2let
3 hosts = builtins.attrNames config.flake.nixosConfigurations;
4in
5{
6 flake.modules.nixos.core =
7 { pkgs, ... }:
8 {
9 environment.systemPackages = [
10 (pkgs.writers.writeFishBin "deploy" (builtins.readFile ./deploy.fish))
11 ];
12 };
13
14 flake.modules.hjem.core = {
15 fish.interactiveShellInit = # fish
16 ''
17 complete -c deploy -s R -l remote
18 set commands build switch boot test dry-build dry-activate
19 complete -c deploy -s c -l command -x -a "$commands"
20 complete -c deploy -s r -l revision -x \
21 -a "(COMPLETE=fish jj -- jj show ' ' | string trim)"
22 complete -c deploy -f -a "${(builtins.concatStringsSep " " hosts)}"
23 '';
24 };
25}