Unverified Commit 631d512b authored by h7x4's avatar h7x4
Browse files

nrfutil: install shell completion

parent f9dd23d4
Loading
Loading
Loading
Loading
+68 −51
Original line number Diff line number Diff line
@@ -12,6 +12,7 @@
  autoPatchelfHook,
  versionCheckHook,
  makeWrapper,
  installShellFiles,

  symlinkJoin,
  extensions ? [ ],
@@ -36,7 +37,9 @@ let
    ];
  };

  packages = map (
  packages =
    map
      (
        name:
        let
          package = platformSources.packages.${name};
@@ -84,7 +87,14 @@ let
            mainProgram = name;
          };
        })
  ) ([ "nrfutil" ] ++ extensions);
      )
      (
        [
          "nrfutil"
          "nrfutil-completion"
        ]
        ++ extensions
      );

in
symlinkJoin {
@@ -93,7 +103,10 @@ symlinkJoin {

  paths = packages;

  nativeBuildInputs = [ makeWrapper ];
  nativeBuildInputs = [
    makeWrapper
    installShellFiles
  ];

  postBuild =
    let
@@ -118,7 +131,11 @@ symlinkJoin {
      );
    in
    ''
      wrapProgram $out/bin/nrfutil ${wrapProgramArgs}
      wrapProgram "$out"/bin/nrfutil ${wrapProgramArgs}

      installShellCompletion --cmd nrfutil \
        --bash $(realpath "$out"/share/nrfutil-completion/scripts/bash/setup.bash) \
        --zsh $(realpath "$out"/share/nrfutil-completion/scripts/zsh/_nrfutil)
    '';

  passthru = {