3
0
Fork 0
forked from mirrors/nixpkgs
Commit graph

18 commits

Author SHA1 Message Date
Dominik Xaver Hörl b20ec4f719 pkgs/build-support/writers: allow passing ghc arguments in writeHaskell 2020-09-07 19:36:58 +02:00
Adrian a6133b7a39
writers.makeScriptWriter: fix on Darwin\MacOS (#93757)
* writers.makeScriptWriter: fix on Darwin\MacOS

On Darwin a script cannot be used as an interpreter in a shebang line, which
causes scripts produced with makeScriptWriter (and its derivatives) to fail at
run time if the used interpreter was wrapped with makeWrapper (as in the case
of python3.withPackages).

This commit fixes the problem by detecting if the interpreter is a script
and prepending its shebang to the final interpreter line.

For example if used interpreter is;
```
/nix/store/ynwv137n2650qy39swcflxbcygk5jwv1-python3-3.8.3-env/bin/python
```

which is a script with following shebang:
```
#! /nix/store/knd85yc7iwli8344ghav3zli8d9gril0-bash-4.4-p23/bin/bash -e
```

then the shebang line in the produced script will be
```
#! /nix/store/knd85yc7iwli8344ghav3zli8d9gril0-bash-4.4-p23/bin/bash -e /nix/store/ynwv137n2650qy39swcflxbcygk5jwv1-python3-3.8.3-env/bin/python
```

This works on Darwin since there does not seem to be a limit to the length
of the shabang line and the shebang lines support multiple arguments to
the interpreters (as opposed to linux where the kernel imposes a strict limit
on shebang lengh and everything following the interpreter is passed to it
as a single string).

fixes; #93609
related to: #65351 #11133 (and probably a bunch of others)

NOTE: scripts produced on platforms other than Darwin will remain unmodified
by this PR. However it might worth considering extending this fix to BSD systems
in general. I didn't do it since I have no way of testing it on systems other
than MacOS and linux.

* writers.makeScriptWriter: fix typo in comment

* writers.makeScriptWriter: fail build if interpreter of interpreter is a script
2020-07-25 11:47:20 +02:00
Adrian Gierakowski 76437a88bb writers.writePython2 and writePython3: use "bare" python if no deps are needed
`python.withPackages` has a runtime dependecy on bash since it's wrapped with
`makeWrapper`. This fix avoids bash as runtime dependency when it's not
needed.

as discussed here: https://github.com/NixOS/nixpkgs/issues/93609#issuecomment-662880047
2020-07-24 11:39:01 +01:00
Profpatsch 493c357720 pkgs/build-support/writers: use runCommandLocal for scripts
If we just want to write a non-compiled script (e.g. writeDash), it’s
usually a lot faster just doing it locally. That’s what
`runCommandLocal` was introduced for, so let’s use it in `writers`.
2020-02-18 19:53:18 +01:00
Chuck 6498f468af WriteHaskell: Strip binaries
This reduces the size of Hello World [1] from 3.06 MiB to 678 KiB.

[1] As measured by nix-shell -p 'writers.writeHaskellBin "hello" {} "main = putStrLn \"hello\""' --run 'ls -l `which hello`'
2019-12-14 09:32:34 +01:00
lassulus 6d807882ad writers test: use writeC with library for testing 2019-10-23 20:47:27 +02:00
lassulus e7cccb74ee writers test: fix python2 linter errors 2019-10-23 20:47:27 +02:00
lassulus a5d874935e writers: fix writeC libraries detection 2019-10-23 20:47:27 +02:00
volth 7b8fb5c06c treewide: remove redundant quotes 2019-09-08 23:38:31 +00:00
Silvan Mosberger 478e7184f8
nixos/modules: Remove all usages of types.string
And replace them with a more appropriate type

Also fix up some minor module problems along the way
2019-08-31 18:19:00 +02:00
lassulus 9746fae577 build-support/writers: actually run checks 2019-05-28 07:51:46 +02:00
lassulus ea9161e095 writeC: fix finding of libraries 2019-04-21 13:12:33 +02:00
Izorkin 496a73d46d nixos/nginx: fix error in writeNginxConfig 2019-04-08 16:44:23 +03:00
tv 7437268cd4 build-support writers: add writeNginxConfig 2019-03-20 18:47:48 +01:00
volth bb9557eb7c lib.makePerlPath -> perlPackages.makePerlPath 2018-12-15 03:50:31 +00:00
lassulus 995defbb9b build-support writers: content can be string or file 2018-12-04 16:40:32 +01:00
lassulus 2d02cd7790 build-support writers: add tests 2018-11-27 07:08:13 +01:00
lassulus abd0efae35 build-support: add writers from krebs/writers
Reference https://github.com/krebs/nix-writers revision 40fde9e
2018-11-27 07:08:12 +01:00