My custom package not in PATH

Hello,

I created a custom pkg with a bash script.

{
  stdenvNoCC,
  lib,
  fetchurl,
  ...
}:

stdenvNoCC.mkDerivation {
  pname = "dpkutils";
  version = "4.0.0";
  src = fetchurl {
    url = "https://X/assets/kutils.tgz";
    sha256 = "d9ea4b4a689da221983975585d7ac68bc7c972dd8391f5c035e291b23dd6467d";
  };
  installPhase = ''
    mkdir -p $out/usr/bin
    cp -vp k.txt $out/usr/bin/k
    chmod +x $out/usr/bin/k
  '';

  meta = with lib; {
    description = "Kubernetes helper dp";
    homepage = "https://x/";
    platforms = platforms.all;
  };
}

It installs fine, but its not in the bash path, i can only run it by specifying the exact path, this doesn’t happen to any other packages.
Any idea how to fix it?

[root@desktop:/etc/nixos/nixflakes]# find / -type f -name k
/nix/store/fsnbshgdwd5kkzkggjyc4lykhl5g20vy-dpkutils-4.0.0/usr/bin/k
find: ‘/run/user/6000/doc’: Permission denied
find: ‘/run/user/6000/gvfs’: Permission denied
[root@desktop:/etc/nixos/nixflakes]#

Put it in $out/bin, not $out/usr/bin

2 Likes

Oh, so easy! Thanks a lot!