Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@

backend.cli
backend.dotcoreCli
backend.dotcDevCompletions

nodejs_24

Expand Down
14 changes: 14 additions & 0 deletions nix/backend.nix
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,24 @@ let
exec nix run .#dotcore -- "$@"
'';
};

# Fish autoloads a command's completions from `<dir>/fish/vendor_completions.d/<cmd>.fish`
# under every XDG_DATA_DIRS entry, and the dev shell exposes each package's share dir there.
# This file generates dotc's completions from the dev shell's dotc itself, on the first
# completion request, so entering the shell never waits for the dotc build.
dotcDevCompletions = pkgs.runCommand "dotc-dev-completions" { } ''
mkdir -p $out/share/fish/vendor_completions.d
cat > $out/share/fish/vendor_completions.d/dotc.fish <<'EOF'
# The dev shell's dotc builds the CLI on first use, so completions generate from it
# only once fish asks for them.
COMPLETE=fish dotc | source
EOF
'';
in
{
package = backend;
test = backendTest;
cli = dotcDevelopmentCommand;
dotcoreCli = dotcoreDevelopmentCommand;
dotcDevCompletions = dotcDevCompletions;
}