-
-
Notifications
You must be signed in to change notification settings - Fork 14.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
installShellFiles: rework and add installBin function (#332612)
- Loading branch information
Showing
18 changed files
with
399 additions
and
168 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
lib, | ||
callPackage, | ||
makeSetupHook, | ||
}: | ||
|
||
# See the header comment in ./setup-hook.sh for example usage. | ||
makeSetupHook { | ||
name = "install-shell-files"; | ||
passthru = { | ||
tests = lib.packagesFromDirectoryRecursive { | ||
inherit callPackage; | ||
directory = ./tests; | ||
}; | ||
}; | ||
} ./setup-hook.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
pkgs/by-name/in/installShellFiles/tests/install-bin-output.nix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
lib, | ||
installShellFiles, | ||
runCommandLocal, | ||
}: | ||
|
||
runCommandLocal "install-shell-files--install-bin-output" | ||
{ | ||
outputs = [ | ||
"out" | ||
"bin" | ||
]; | ||
nativeBuildInputs = [ installShellFiles ]; | ||
meta.platforms = lib.platforms.all; | ||
} | ||
'' | ||
mkdir -p bin | ||
echo "echo hello za warudo" > bin/hello | ||
echo "echo amigo me gusta mucho" > bin/amigo | ||
installBin bin/* | ||
# assert it didn't go into $out | ||
[[ ! -f $out/bin/amigo ]] | ||
[[ ! -f $out/bin/hello ]] | ||
cmp bin/amigo ''${!outputBin}/bin/amigo | ||
cmp bin/hello ''${!outputBin}/bin/hello | ||
touch $out | ||
'' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
lib, | ||
installShellFiles, | ||
runCommandLocal, | ||
}: | ||
|
||
runCommandLocal "install-shell-files--install-bin" | ||
{ | ||
nativeBuildInputs = [ installShellFiles ]; | ||
meta.platforms = lib.platforms.all; | ||
} | ||
'' | ||
mkdir -p bin | ||
echo "echo hello za warudo" > bin/hello | ||
echo "echo amigo me gusta mucho" > bin/amigo | ||
installBin bin/* | ||
cmp bin/amigo $out/bin/amigo | ||
cmp bin/hello $out/bin/hello | ||
'' |
24 changes: 24 additions & 0 deletions
24
pkgs/by-name/in/installShellFiles/tests/install-completion-cmd.nix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
lib, | ||
installShellFiles, | ||
runCommandLocal, | ||
}: | ||
|
||
runCommandLocal "install-shell-files--install-completion-cmd" | ||
{ | ||
nativeBuildInputs = [ installShellFiles ]; | ||
meta.platforms = lib.platforms.all; | ||
} | ||
'' | ||
echo foo > foo.bash | ||
echo bar > bar.zsh | ||
echo baz > baz.fish | ||
echo qux > qux.fish | ||
installShellCompletion --cmd foobar --bash foo.bash --zsh bar.zsh --fish baz.fish --name qux qux.fish | ||
cmp foo.bash $out/share/bash-completion/completions/foobar.bash | ||
cmp bar.zsh $out/share/zsh/site-functions/_foobar | ||
cmp baz.fish $out/share/fish/vendor_completions.d/foobar.fish | ||
cmp qux.fish $out/share/fish/vendor_completions.d/qux | ||
'' |
Oops, something went wrong.