mirror of
https://github.com/tweag/gomod2nix.git
synced 2024-11-08 11:39:11 +00:00
Install shell completions in derivation
This commit is contained in:
parent
ab0d607923
commit
363017e3f3
1 changed files with 9 additions and 3 deletions
12
default.nix
12
default.nix
|
@ -1,4 +1,4 @@
|
||||||
{ buildGoApplication, go, nix, lib, makeWrapper, nix-prefetch-git }:
|
{ stdenv, buildGoApplication, go, nix, lib, makeWrapper, installShellFiles }:
|
||||||
|
|
||||||
buildGoApplication {
|
buildGoApplication {
|
||||||
inherit go;
|
inherit go;
|
||||||
|
@ -18,9 +18,15 @@ buildGoApplication {
|
||||||
|
|
||||||
subPackages = [ "." ];
|
subPackages = [ "." ];
|
||||||
|
|
||||||
nativeBuildInputs = [ makeWrapper ];
|
nativeBuildInputs = [ makeWrapper installShellFiles ];
|
||||||
|
|
||||||
postInstall = ''
|
postInstall = lib.optionalString (stdenv.hostPlatform == stdenv.targetPlatform) ''
|
||||||
|
$out/bin/gomod2nix completion bash > gomod2nix.bash
|
||||||
|
$out/bin/gomod2nix completion fish > gomod2nix.fish
|
||||||
|
$out/bin/gomod2nix completion zsh > _gomod2nix
|
||||||
|
installShellCompletion gomod2nix.{bash,fish} _gomod2nix
|
||||||
|
'' + ''
|
||||||
wrapProgram $out/bin/gomod2nix --prefix PATH : ${lib.makeBinPath [ go ]}
|
wrapProgram $out/bin/gomod2nix --prefix PATH : ${lib.makeBinPath [ go ]}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue