Describe the bug
Executables produced by writers.writePython3 (and probably also writePython2 etc) fail to run on MacOS
To Reproduce
Steps to reproduce the behavior:
- clone https://github.com/adrian-gierakowski/nix-writePython3-broken-on-darwin
- run
$(nix-build) from top level the repo (assuming POSIX shell)
- see it fail
Expected behavior
The command from step 2 should print success
Additional context
This seems to be caused by the fact that ${python3.withPackages}/bin/python which is used for shebang line
in the produced script is itself a "script text executable" which does not seem to work on MacOS.
The repo mentioned above contains a tentative fix, which prepend ${pkgs.bash}/bin/bash to the shebang line in the produced script.
NOTE: the repo above uses my own fork of nixpkgs since dash is currently broken on darwin (and writePython3 depends on dash)
Notify maintainers
@Lassulus
Metadata
- system:
"x86_64-darwin"
- host os:
Darwin 18.7.0, macOS 10.14.6
- multi-user?:
no
- sandbox:
yes
- version:
nix-env (Nix) 2.3.6pre7027_6f162d8
- channels(adriangierakowski):
""
- nixpkgs:
/nix/store/ciqd3l5bznq5ms389b4w7yjv7vk9vpm0-source
Maintainer information:
# a list of nixpkgs attributes affected by the problem
attribute:
- writers.writePython2
- writers.writePython3
- writers.writePython2Bin
- writers.writePython3Bin
Describe the bug
Executables produced by
writers.writePython3(and probably also writePython2 etc) fail to run on MacOSTo Reproduce
Steps to reproduce the behavior:
$(nix-build)from top level the repo (assuming POSIX shell)Expected behavior
The command from step 2 should print
successAdditional context
This seems to be caused by the fact that
${python3.withPackages}/bin/pythonwhich is used for shebang linein the produced script is itself a "script text executable" which does not seem to work on MacOS.
The repo mentioned above contains a tentative fix, which prepend
${pkgs.bash}/bin/bashto the shebang line in the produced script.NOTE: the repo above uses my own fork of nixpkgs since dash is currently broken on darwin (and
writePython3depends on dash)Notify maintainers
@Lassulus
Metadata
"x86_64-darwin"Darwin 18.7.0, macOS 10.14.6noyesnix-env (Nix) 2.3.6pre7027_6f162d8""/nix/store/ciqd3l5bznq5ms389b4w7yjv7vk9vpm0-sourceMaintainer information: