Commit Graph

74 Commits

Author SHA1 Message Date
aszlig
1cba74dfc1
setup-hooks: Add autoPatchelfHook
I originally wrote this for packaging proprietary games in Vuizvui[1]
but I thought it would be generally useful as we have a fair amount of
proprietary software lurking around in nixpkgs, which are a bit tedious
to maintain, especially when the library dependencies change after an
update.

So this setup hook searches for all ELF executables and libraries in the
resulting output paths after install phase and uses patchelf to set the
RPATH and interpreter according to what dependencies are available
inside the builder.

For example consider something like this:

stdenv.mkDerivation {
  ...
  nativeBuildInputs = [ autoPatchelfHook ];
  buildInputs = [ mesa zlib ];
  ...
}

Whenever for example an executable requires mesa or zlib, the RPATH will
automatically be set to the lib dir of the corresponding dependency.

If the library dependency is required at runtime, an attribute called
runtimeDependencies can be used to list dependencies that are added to
all executables that are discovered unconditionally.

Beside this, it also makes initial packaging of proprietary software
easier, because one no longer has to manually figure out the
dependencies in the first place.

[1]: https://github.com/openlab-aux/vuizvui

Signed-off-by: aszlig <aszlig@nix.build>
Closes: #34506
2018-02-10 00:27:24 +05:30
John Ericson
4e907dbca1 stdenv: Force doCheck and doInstallCheck to be false when we are cross compiling
I hope this will be a temporary measure. If there is consensus around
issue #33599, then we can follow an explicit `dontCheck`, but default to
not checking during cross builds when none is given.
2018-01-09 12:37:12 -05:00
John Ericson
edfe42f3ba doc: More information in the setup hook section of the stdenv chapter 2017-12-30 22:42:14 -05:00
John Ericson
b55999b28f doc: Document dontStripHost and dontStripTarget 2017-12-30 22:41:44 -05:00
John Ericson
7ffc4e1b2f doc: Add "Specifying Dependencies" section to the stdenv chapter
This accounts for all the new dependencies and propagation logic changes
I'm about to add.

Fixes #1915---with this change I think the distinction is finally clear
enough.
2017-12-30 22:35:59 -05:00
John Ericson
a0b1ebeee9 Merge remote-tracking branch 'upstream/staging' into binutils-wrapper 2017-12-13 16:14:47 -05:00
John Ericson
91ca46f693 doc: Document Bintools Wrapper
Shrunk the CC Wrapper documentation so as not to be repetative.
2017-12-13 16:08:18 -05:00
Orivej Desh
683047f8ab doc: document enableParallelBuilding being unset 2017-12-07 08:52:42 +00:00
Bruno Bieth
0e05dfcfa2 Typo in manual#stdenv - propagatedNativeBuildInputs 2017-11-13 17:55:18 +01:00
Daiderd Jordan
1167fde2b2 docs: add note about makeFlags quoting 2017-11-01 17:50:15 +01:00
John Ericson
bc0aec5d97 doc: Document forthcomming NIX_DEBUG degredations 2017-09-26 11:24:19 -04:00
John Ericson
0578dda8e1 doc: Describe CC Wrapper in more detail
The main motivation for this is to have something to google for LD=$CC.

Eventually, this should probably be moved to another section, but we
can deal with that later.
2017-08-20 15:49:50 -04:00
John Ericson
594d264205 cross stdenv adaptor: Support --host --build --target across the board
Packages get --host and --target by default, but can explicitly request
any subset to be passed as needed. See docs for more info.

rustc: Avoid hash breakage by using the old (ignored)
dontSetConfigureCross when not cross building
2017-06-22 17:52:28 -04:00
Frederik Rietdijk
75933da882 Merge pull request #26345 from vcunat/p/doc-override-phases
nixpkgs manual: advise against overriding whole phases
2017-06-19 09:48:01 +02:00
Jan Tojnar
e35f3c0679
doc: Fix some typos 2017-06-11 22:13:42 +02:00
Vladimír Čunát
8c6fada372
nixpkgs manual: advise against overriding whole phases
I've seen that mistake at least a few times already, e.g.
https://github.com/NixOS/nixpkgs/pull/26209#issuecomment-305925562
It might perhaps seem counter-intuitive if one doesn't know nixpkgs well.
2017-06-03 11:24:18 +02:00
Vladimír Čunát
3b583d943e
Merge #19328: mkWrapper fix and docs 2017-02-05 14:09:22 +01:00
John Ericson
76ea89aa78 nixpkgs doc: Talk about nativeBuildInputs and propgatedNativeBuildInputs
Do so in the stdenv section where the other two are discussed. This can be
done without brining up cross-compilation by talking about build-time vs
run-time.
2017-01-24 11:37:56 -05:00
Franz Pletz
00ab8e84c6
doc: improve hardening docs
Fixes #18887.
2017-01-20 17:46:44 +01:00
Profpatsch
bef6bef0d2
stdenv/stripHash: print to stdout, not to variable
`stripHash` documentation states that it prints out the stripped name to
the stdout, but the function stored the value in `strippedName`
instead.

Basically all usages did something like
`$(stripHash $foo | echo $strippedName)` which is just braindamaged.
Fixed the implementation and all invocations.
2016-10-11 18:34:36 +02:00
Profpatsch
dd58d24fa6 stdenv: document makeWrapper
Add function documentation to `makeWrapper`.
Also add user documentation to the nixpkgs manual.
2016-10-08 23:36:40 +02:00
Michael Raskin
d233366856 manual: switch an example from md5 to sha256. 2016-10-07 10:08:22 +02:00
Eric Sagnes
41d62fdea8 nixpkgs doc: add installCheck phase 2016-09-28 16:31:46 +09:00
Domen Kožar
7b3a36132a Merge pull request #9607 from nckx/update-doc
doc: specify that *Flags are string lists
2016-08-31 10:02:16 +02:00
Robin Gloster
af04b6d5a5 hardening docs: fix typo 2016-08-13 10:06:24 +00:00
Franz Pletz
55966c2189 doc: complete the hardening documentation 2016-08-12 18:14:02 +02:00
Robin Gloster
f222d98746 Merge remote-tracking branch 'upstream/master' into hardened-stdenv 2016-07-25 12:47:13 +00:00
Joachim Fasting
c6ccc96397
nixpkgs manual: document the paxctl setup-hook 2016-07-23 19:09:48 +02:00
Robin Gloster
5185bc1773 Merge remote-tracking branch 'upstream/master' into hardened-stdenv 2016-07-15 14:41:01 +00:00
zimbatm
4f5918cd2e Revert "stdenv: introduce baseHash() to replace stripHash()"
Introduced by mistake

This reverts commit e71a5cb878.
2016-06-25 14:25:58 +01:00
zimbatm
e71a5cb878 stdenv: introduce baseHash() to replace stripHash()
stripHash uses a global variable to communicate it's computation
results, but it's not necessary. You can just pipe to stdout in a
subshell. A function mostly behaves like just another command.

baseHash() also introduces a suffix-stripping capability since it's
something the users of the function tend to use.
2016-06-25 14:20:56 +01:00
Tom Boettcher
a1083a5d27 doc: Update stripHash documentation
The documentation now matches the behavior of the function.
2016-06-21 09:38:11 -05:00
Franz Pletz
f8d481754c
Merge remote-tracking branch 'origin/master' into hardened-stdenv 2016-05-18 17:10:02 +02:00
Profpatsch
c6cfa7a412 manual/substituteAll: document filtered variables
Some variables are filtered out as of #14907.
2016-05-07 13:10:09 +02:00
Robin Gloster
d020caa5b2 Merge remote-tracking branch 'upstream/master' into hardened-stdenv 2016-04-18 13:49:22 +00:00
Vladimír Čunát
c73191f11e nixpkgs manual: add multiple-output chapter 2016-04-07 16:00:41 +02:00
Robin Gloster
fda63b8b57 nixpkgs docs: stackprotector hardening 2016-02-22 00:33:01 +00:00
Robin Gloster
911d22f88d nixpkgs docs: format hardening 2016-02-22 00:23:15 +00:00
Benjamin Staffin
420bb27a7b docs: Mention autoreconfHook in Package Setup Hooks 2016-01-23 18:19:23 -05:00
Nikolay Amiantov
9c1d8037c0 nixpkgs manual: add a section about passthru 2016-01-21 19:47:53 +03:00
Nikolay Amiantov
f727f815cb nixpkgs manual: mention preferLocalBuild and enableParallelBuilding 2016-01-21 18:44:27 +03:00
Peter Simons
f1f4ea210b Revert "Fixed typo." 2015-11-24 10:44:43 +01:00
Rommel M. Martinez
8bc4cd5076 Fixed typo. 2015-11-23 16:22:12 +08:00
Thomas Tuegel
79be4a769f manual: document Qt packaging tools 2015-09-27 16:06:29 -05:00
Eelco Dolstra
ec5b66eb4a Enable separate debug info
You can now pass

  separateDebugInfo = true;

to mkDerivation. This causes debug info to be separated from ELF
binaries and stored in the "debug" output. The advantage is that it
enables installing lean binaries, while still having the ability to
make sense of core dumps, etc.
2015-09-17 15:56:33 +02:00
Tobias Geerinckx-Rice
9413ad38fb doc: specify that *Flags are string lists 2015-09-02 17:31:32 +02:00
Pascal Wittmann
cdd999baee doc: document dontMoveSbin variable 2015-07-09 12:43:34 +02:00
Pascal Wittmann
9c983ade4d doc: fix references 2015-06-02 11:22:19 +02:00
Pascal Wittmann
53b5d946e1 doc: add section ids
This commit also use enforces consistent use of the prefixes "sec" for
section and "ssec" for subsection.
2015-05-31 18:41:34 +02:00
Vladimír Čunát
75ebc3cf1d doc/stdenv: fix manual build after #7711 2015-05-09 14:58:40 +02:00