I'm trying to make a nixos package from a program distributed in binary form only. Like most, links to the standard linker and to libraries don't match a nixos system, so I'm trying to create a new derivation that uses patchelf
to update those link. I'm basing my work off of the zoom-us
package already in the packages repository.
However, when I try to install the package, I get this error:
savanni@lapis:~ $ nix-env -i all --show-trace
replacing old ‘all’
installing ‘all’
error: while evaluating the attribute ‘pkgs’ of the derivation ‘all’ at /nix/store/1fxfp03ya08rnzrzyxy7dhca3c5qm0jk-nixos-16.09.1829.c88e67d/nixos/pkgs/build-support/trivial-builders.nix:10:14:
while evaluating the attribute ‘nativeBuildInputs’ of the derivation ‘GoPanda’ at /home/savanni/.nixpkgs/gopanda2.nix:9:5:
cannot coerce a set to a string, at /home/savanni/.nixpkgs/gopanda2.nix:9:5
Here is the text of my derivation:
{ cairo, fetchurl, glib, patchelf, stdenv, xorg }:
stdenv.mkDerivation rec {
name = "GoPanda";
version = "2";
meta = {
homepage = "http://pandanet-igs.com/communities/gopanda2";
};
src = fetchurl {
url = "http://pandanet-igs.com/gopanda2/installer/stable/linux-64/gopanda2-linux-64.tar.gz";
sha256 = "6d0a13e81a4646779331ff182acdbf9fe7982b2659f12a794a50897ea7368e1c";
};
phases = [ "unpackPhase" "installPhase" ];
nativeBuildInputs = [ ];
buildInputs = [
cairo
glib
xorg
];
libPath = stdenv.lib.makeLibraryPath buildInputs;
installPhase = ''
mkdir -p $out/bin
cp GoPanda2 $out/bin/GoPanda2
patchelf \
--set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
--set-rpath ${libPath} \
$out/bin/GoPanda2
'';
}
If I remove the nativeBuildInputs
line, the buildInputs
line, the libPath
line, and references to libPath
, I get a successful build, but an executable that doesn't know where to find the libraries. So I know I need to specify the libraries. Furthermore, I can start with the above code and add things to nativeBuildInputs
, and still get the same error.
But the question is, why is there a failing coercion around nativeBuildInputs
, and how can I fix it?