Skip to content

Instantly share code, notes, and snippets.

@ThoenigAdrian
Created February 8, 2020 22:34
Show Gist options
  • Save ThoenigAdrian/c41dea2ff44e3b15a97725cd2830b36b to your computer and use it in GitHub Desktop.
Save ThoenigAdrian/c41dea2ff44e3b15a97725cd2830b36b to your computer and use it in GitHub Desktop.
[jane@nixos:~/graphviz]$ cat default.nix
let
pkgs = import <nixpkgs> {};
mkDerivation = import ./autotools.nix pkgs;
patchedPkgs = import /home/jane/nixpkgs {} // {binutils-unwrapped="";};
mkDerivation2 = import ./autotools.nix patchedPkgs;
libs = with patchedPkgs; { inherit gd fontconfig bzip2 libjpeg;};
in
{
hello = import ./hello.nix { inherit mkDerivation ;};
graphviz = import ./graphviz.nix ({ mkDerivation = mkDerivation2; } // libs);
graphvizCore = import ./graphviz.nix ({ mkDerivation = mkDerivation2; gdSupport = false; } // libs);
}
[jane@nixos:~/graphviz]$ cat autotools.nix
pkgs: attrs:
with pkgs;
let defaultAttrs = {
builder = "${bash}/bin/bash";
args = [ ./builder.sh ];
baseInputs = [ gzip gnumake gcc binutils-unwrapped binutils coreutils gawk gnused gnugrep gnutar findutils patchelf ];
setup = ./setup.sh;
buildInputs = [];
system = builtins.currentSystem;
};
in
derivation (defaultAttrs // attrs)
[jane@nixos:~/graphviz]$ cat hello.nix
{ mkDerivation }:
mkDerivation {
name="hello";
src=./hello-2.10.tar.gz;
}
[jane@nixos:~/graphviz]$ cat graphviz.nix
{ mkDerivation, gdSupport ? true, gd, fontconfig, libjpeg, bzip2 }:
mkDerivation {
name = "graphviz";
src = ./graphviz-2.38.0.tar.gz;
buildInputs = if gdSupport then [ gd fontconfig libjpeg bzip2 ] else [];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment