mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-05-02 14:26:23 -04:00
nix: add derivations for C library dependencies
Cryptsetup and libvirt are new. OpenSSL was moved with the rest. The dynamic libaries cryptsetup and libvirt also ship a file called closure.tar, that contains the transitive closure for all of their dependencies. This tar file can be used as a container image layer or added to a bootable OS image to provide the runtime dependencies required for dynamic linking. Additionally, they ship a `rpath` file. This can be used together with patchelf to fix the RPATH of binaries produced by Bazel.
This commit is contained in:
parent
e174c4dfe1
commit
e895aa5495
4 changed files with 52 additions and 4 deletions
19
nix/cc/libvirt.nix
Normal file
19
nix/cc/libvirt.nix
Normal file
|
@ -0,0 +1,19 @@
|
|||
{ pkgs, pkgsLinux, buildEnv, closureInfo }:
|
||||
let
|
||||
lib = pkgs.lib;
|
||||
cc = pkgsLinux.stdenv.cc;
|
||||
packages = [ pkgsLinux.libvirt ];
|
||||
closure = builtins.toString (lib.strings.splitString "\n" (builtins.readFile "${closureInfo {rootPaths = packages;}}/store-paths"));
|
||||
rpath = pkgs.lib.makeLibraryPath [ pkgsLinux.libvirt pkgsLinux.glib pkgsLinux.libxml2 pkgsLinux.readline pkgsLinux.glibc pkgsLinux.libgcc.lib ];
|
||||
in
|
||||
pkgs.symlinkJoin {
|
||||
name = "libvirt";
|
||||
paths = packages;
|
||||
buildInputs = packages;
|
||||
postBuild = ''
|
||||
tar -cf $out/closure.tar --mtime="@$SOURCE_DATE_EPOCH" --sort=name ${closure}
|
||||
tar --transform 's+^./+bin/+' -cf $out/bin-linktree.tar --mtime="@$SOURCE_DATE_EPOCH" --sort=name -C $out/bin .
|
||||
echo "${rpath}" > $out/rpath
|
||||
cp ${cc}/nix-support/dynamic-linker $out/dynamic-linker
|
||||
'';
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue