Skip to content

Instantly share code, notes, and snippets.

@savannidgerinel
Created September 12, 2017 02:20
Show Gist options
  • Save savannidgerinel/1345faee6e4b4867567b84388ffc90fa to your computer and use it in GitHub Desktop.
Save savannidgerinel/1345faee6e4b4867567b84388ffc90fa to your computer and use it in GitHub Desktop.
Problems getting a system dependency into a haskell nix derivation
{ pkgs ? import <nixos> {}
, compiler ? "ghc7103"
, libstatgrab ? pkgs.libstatgrab
, zlib ? pkgs.zlib
}:
let
systemstats = pkgs.haskell.packages.${compiler}.callPackage ./systemstats.nix { libstatgrab = libstatgrab; };
in pkgs.stdenv.mkDerivation rec {
name = "systemstats";
version = "0.2.0";
buildInputs = [ libstatgrab
systemstats ];
LD_LIBRARY_PATH = pkgs.stdenv.lib.makeLibraryPath buildInputs;
}
Using tar found on system at:
/nix/store/g3skr3kss1fqqzl5viyg178qbcp4cdky-gnutar-1.29/bin/tar
No uhc found
Setup: Missing dependency on a foreign library:
* Missing (or bad) header file: statgrab.h
* Missing C library: statgrab
This problem can usually be solved by installing the system package that
provides this library (you may need the "-dev" version). If the library is
already installed but in a non-standard location then you can use the flags
--extra-include-dirs= and --extra-lib-dirs= to specify where it is.
If the header file does exist, it may contain errors that are caught by the C
compiler at the preprocessing stage. In this case you can re-run configure
with the verbosity flag -v3 to see the error messages.
builder for ‘/nix/store/63fraxc0qh30ml7k995aqiw8d91b5x6y-statgrab-0.1.3.drv’ failed with exit code 1
cannot build derivation ‘/nix/store/lranjj1gmp6gcc1maz4n0xmghhqynbid-systemstats-0.2.0.drv’: 1 dependencies couldn't be built
cannot build derivation ‘/nix/store/68d6s5rg3xbjz3y6h1j537jmc2bq67kr-systemstats.drv’: 1 dependencies couldn't be built
error: build of ‘/nix/store/68d6s5rg3xbjz3y6h1j537jmc2bq67kr-systemstats.drv’ failed
{ mkDerivation, aeson, base, bytestring, micrologger
, optparse-applicative, process, statgrab, stdenv, text
, text-format, time, transformers, libstatgrab
}:
mkDerivation {
pname = "systemstats";
version = "0.2.0";
src = ./.;
isLibrary = false;
isExecutable = true;
libraryHaskellDepends = [ libstatgrab ];
executableHaskellDepends = [
aeson base bytestring micrologger optparse-applicative process
statgrab text text-format time transformers libstatgrab
];
homepage = "https://github.com/githubuser/systemlog#readme";
description = "An application that regularly logs system stats for later analysis";
license = stdenv.lib.licenses.bsd3;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment