nixpkgs/pkgs/top-level
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
..
aliases.nix Merge remote-tracking branch 'upstream/master' into staging 2018-02-03 02:50:21 +02:00
all-packages.nix setup-hooks: Add autoPatchelfHook 2018-02-10 00:27:24 +05:30
beam-packages.nix Elixir: 1.6-rc -> 1.6 2018-01-17 14:22:48 -05:00
coq-packages.nix coq: default to 8.7 2018-02-07 19:28:38 +00:00
darwin-packages.nix Update darwin-packages.nix 2018-02-06 00:41:35 +08:00
default.nix Add setFunctionArgs lib function. 2018-01-31 14:02:19 -05:00
dotnet-packages.nix treewide: homepage+src updates (found by repology, #33263) 2018-01-05 20:42:46 +01:00
emacs-packages.nix Merge pull request #31312 from binarin/emacs-package-set-overrides 2018-02-06 21:22:23 +00:00
emscripten-packages.nix misc pkgs: Manual fixup pkgconfig nativeBuildInputs after sed 2017-09-21 15:49:54 -04:00
haskell-packages.nix Drop broken Haskell compilers. 2018-01-26 13:01:11 +01:00
haxe-packages.nix
impure.nix
java-packages.nix
lua-packages.nix lgi: Fix cairo bindings search path 2018-02-04 11:23:35 +01:00
make-tarball.nix make-tarball.nix: Fix <nixpkgs> check 2017-12-07 16:00:09 +01:00
metrics.nix nixpkgs.metrics: --show-trace into the log 2017-11-25 07:07:27 +01:00
ocaml-packages.nix ocamlPackages.uri: 1.9.2 -> 1.9.5 2018-01-14 05:28:49 +00:00
perl-packages.nix perl-Encode: 2.93 -> 2.95 2018-02-08 21:01:12 +01:00
php-packages.nix Merge pull request #34496 from etu/php722 2018-02-03 22:32:42 +08:00
pure-packages.nix
python-packages.nix pythonnet: Init at 2.3.0 2018-02-08 21:29:36 -05:00
release-cross.nix release-cross: Try building on Windows too 2018-01-22 11:29:15 -05:00
release-lib.nix nixos/release.nix: Move forAllSystems to release-lib 2018-01-16 18:56:41 +02:00
release-python.nix
release-small.nix release-small: Don't attempt to access "dbus.libs", etc., don't exist 2018-01-12 18:06:53 -06:00
release.nix linux bootstrap tools: Use same derivation whether cross compiling or not 2018-01-02 13:52:41 -05:00
splice.nix top-level: Splice in more package sets for new types of deps 2017-12-30 22:04:20 -05:00
stage.nix top-level: Duplicate overlaying unless stdenvOverrides comes last 2018-01-31 00:16:27 -05:00