How can I distinguish between two packages who has the same name for the executable?

I want to use both


, but they both have “jira” as the binary name

Is there some way to have one called jira-cli-go and the other go-jira?:wink:

1 Like

Hah, awkward. I think the easiest solution is to just get their full paths, but if you want them to show up with different binary names in $PATH you’ll have to make some kind of wrapper.

I think this should work:

environment.systemPackages = [
  (pkgs.runCommand "jira-cli-go" { nativeBuildInputs = [ pkgs.makeWrapper ]; } ''
    mkdir -p $out/bin
    makeWrapper --argv0 jira ${pkgs.jira-cli-go}/bin/jira $out/bin/jira-cli-go
1 Like

Hmm, no;)

    (pkgs.runCommand "jira-cli-go" { nativeBuildInputs = [ pkgs.makeWrapper ]; } ''
                     mkdir -p $out/bin
                     makeWrapper --argv0 jira ${pkgs.jira-cli-go}/bin/jira $out/bin/jira-cli-go
    (pkgs.runCommand "go-jira" { nativeBuildInputs = [ pkgs.makeWrapper ]; } ''
                     mkdir -p $out/bin
                     makeWrapper --argv0 jira ${pkgs.go-jira}/bin/jira $out/bin/go-jira
building Nix...
building the system configuration...
these 18 derivations will be built:
building '/nix/store/fd8cbnpf1qwy08bph7gj5qm0z7f7bdrw-go-jira.drv'...
building '/nix/store/yd1hhvrx5j3dkfapfckqmpgs7iq67d6g-jira-cli-go.drv'...

Builder called die: Cannot wrap '--argv0' because it is not an executable file
7 assertExecutable /nix/store/pi4pikagdhj7vrb18z4g9h6v9qdvx95a-make-shell-wrapper-hook/nix-support/setup-hook
43 makeShellWrapper /nix/store/pi4pikagdhj7vrb18z4g9h6v9qdvx95a-make-shell-wrapper-hook/nix-support/setup-hook
36 makeWrapper /nix/store/pi4pikagdhj7vrb18z4g9h6v9qdvx95a-make-shell-wrapper-hook/nix-support/setup-hook
2 source /build/.attr-0l2nkwhif96f51f4amnlf414lhl4rv9vh8iffyp431v6s28gsr90
1563 genericBuild /nix/store/9v8sc2q2dflxjcz1hsw84b10bvg0wand-stdenv-linux/setup
6 main /nix/store/

error: builder for '/nix/store/fd8cbnpf1qwy08bph7gj5qm0z7f7bdrw-go-jira.drv' failed with exit code 1
error: 1 dependencies of derivation '/nix/store/1r6r1wc8rb665sqar04w2kshsbfs5g7z-system-path.drv' failed to build
error: 1 dependencies of derivation '/nix/store/09v1dv376mmr4g7j6i67wzw08dw10fwc-nixos-system-ximian-23.05.4497.04f431fe64a5.drv' failed to build

1 Like

Ah, whoops, looks like the non-flag argument position is mandatory:

makeWrapper ${pkgs.jira-cli-go}/bin/jira $out/bin/jira-cli-go --argv0 jira

Interesting. These derivations don’t have the original pacakges as inputs. Are you just placing them alongside the binaries and hoping that they already exist?

Would an alternative be to override postInstall be neater? Doesn’t sound like it, as you’d have to know that package’s install step well.

I have go-task ( and taskwarrior that use the same binary name

Nix does some black voodoo that means just referring to the package with ${pkgs.jira-cli-go} is sufficient to create a dependency: Automatic Runtime Dependencies - Nix Pills

postInstall is rarely used upstream and you could just append if you were scared that that could change/isn’t true for a specific package. However, you would need to rebuild the whole package if you changed part of its builder, whereas creating a wrapping derivation means you build a package whose build time is negligible instead.

1 Like