mirror of
https://github.com/NixOS/nix
synced 2025-06-25 06:31:14 +02:00
Merge pull request #11902 from roberth/fix-issue-11892
Fix issue #11892
This commit is contained in:
commit
6b0aceedc5
3 changed files with 40 additions and 5 deletions
|
@ -167,6 +167,35 @@ EOF
|
|||
chmod a+x $TEST_ROOT/marco/polo/default.nix
|
||||
(cd $TEST_ROOT/marco && ./polo/default.nix | grepQuiet "Polo")
|
||||
|
||||
# https://github.com/NixOS/nix/issues/11892
|
||||
mkdir $TEST_ROOT/issue-11892
|
||||
cat >$TEST_ROOT/issue-11892/shebangscript <<EOF
|
||||
#!$(type -P env) nix-shell
|
||||
#! nix-shell -I nixpkgs=$shellDotNix
|
||||
#! nix-shell -p 'callPackage (import ./my_package.nix) {}'
|
||||
#! nix-shell -i bash
|
||||
set -euxo pipefail
|
||||
my_package
|
||||
EOF
|
||||
cat >$TEST_ROOT/issue-11892/my_package.nix <<EOF
|
||||
{ stdenv, shell, ... }:
|
||||
stdenv.mkDerivation {
|
||||
name = "my_package";
|
||||
buildCommand = ''
|
||||
mkdir -p \$out/bin
|
||||
( echo "#!\${shell}"
|
||||
echo "echo 'ok' 'baz11892'"
|
||||
) > \$out/bin/my_package
|
||||
cat \$out/bin/my_package
|
||||
chmod a+x \$out/bin/my_package
|
||||
'';
|
||||
}
|
||||
EOF
|
||||
chmod a+x $TEST_ROOT/issue-11892/shebangscript
|
||||
$TEST_ROOT/issue-11892/shebangscript \
|
||||
| tee /dev/stderr \
|
||||
| grepQuiet "ok baz11892"
|
||||
|
||||
|
||||
#####################
|
||||
# Flake equivalents #
|
||||
|
|
|
@ -37,7 +37,7 @@ let pkgs = rec {
|
|||
mkdir -p $out
|
||||
ln -s ${setupSh} $out/setup
|
||||
'';
|
||||
};
|
||||
} // { inherit mkDerivation; };
|
||||
|
||||
shellDrv = mkDerivation {
|
||||
name = "shellDrv";
|
||||
|
@ -94,5 +94,9 @@ let pkgs = rec {
|
|||
chmod a+rx $out/bin/ruby
|
||||
'';
|
||||
|
||||
inherit (cfg) shell;
|
||||
|
||||
callPackage = f: args: f (pkgs // args);
|
||||
|
||||
inherit pkgs;
|
||||
}; in pkgs
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue