Skip to content

Commit 5699cf5

Browse files
committed
chore: create a programmtic listing of the commands that can be run
1 parent ce5251d commit 5699cf5

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

flake.nix

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,21 @@
568568
wrapProgram $out/bin/dbmate-tool \
569569
--prefix PATH : ${pkgs.lib.makeBinPath [ pkgs.overmind pkgs.dbmate pkgs.nix pkgs.jq pkgs.yq ]}
570570
'';
571+
show-commands = pkgs.runCommand "show-commands" {
572+
nativeBuildInputs = [ pkgs.makeWrapper ];
573+
buildInputs = [ pkgs.nushell ];
574+
} ''
575+
mkdir -p $out/bin
576+
cat > $out/bin/show-commands << 'EOF'
577+
#!${pkgs.nushell}/bin/nu
578+
let json_output = (nix flake show --json --quiet --all-systems | from json)
579+
let apps = ($json_output | get apps.${system})
580+
$apps | transpose name info | select name | each { |it| echo $"Run this app with: nix run .#($it.name)" }
581+
EOF
582+
chmod +x $out/bin/show-commands
583+
wrapProgram $out/bin/show-commands \
584+
--prefix PATH : ${pkgs.nushell}/bin
585+
'';
571586
update-readme = pkgs.runCommand "update-readme" {
572587
nativeBuildInputs = [ pkgs.makeWrapper ];
573588
buildInputs = [ pkgs.nushell ];

0 commit comments

Comments
 (0)