{ stdenv, fetchurl, cmake, qt4, perl, kdelibs, kdebase, automoc4, phonon, gettext}:

stdenv.mkDerivation rec {
  name = "kdiff3-0.9.95";
  src = fetchurl {
    url = "mirror://sourceforge/kdiff3/${name}.tar.gz";
    sha256 = "03rg41vdi44wh7kygv46nkzyrirl6qyar901hnlmdwjpi6ycwwh3";
  };

  # kdebase allows having a konqueror plugin built
  buildInputs = [ cmake qt4 perl kdelibs automoc4 phonon gettext kdebase ];

  # Adjust the version of the DocBook XML to 4.2 ( so that it validates ).
  patches = [ ./adjust-docbook-xml-version-to-4.2.patch ];

  meta = {
    homepage = http://kdiff3.sourceforge.net/;
    license = "GPLv2+";
    description = "Compares and merges 2 or 3 files or directories";
    maintainers = with stdenv.lib.maintainers; [viric];
    platforms = with stdenv.lib.platforms; linux;
  };
}

Remove kdebase as input to kdiff3.

{ stdenv, fetchurl, cmake, qt4, perl, kdelibs, automoc4, phonon, gettext}:

stdenv.mkDerivation rec {
  name = "kdiff3-0.9.95";
  src = fetchurl {
    url = "mirror://sourceforge/kdiff3/${name}.tar.gz";
    sha256 = "03rg41vdi44wh7kygv46nkzyrirl6qyar901hnlmdwjpi6ycwwh3";
  };

  # kdebase allows having a konqueror plugin built
  buildInputs = [ cmake qt4 perl kdelibs automoc4 phonon gettext ];

  # Adjust the version of the DocBook XML to 4.2 ( so that it validates ).
  patches = [ ./adjust-docbook-xml-version-to-4.2.patch ];

  meta = {
    homepage = http://kdiff3.sourceforge.net/;
    license = "GPLv2+";
    description = "Compares and merges 2 or 3 files or directories";
    maintainers = with stdenv.lib.maintainers; [viric];
    platforms = with stdenv.lib.platforms; linux;
  };
}


{ stdenv, fetchsvn, writeScript, ocaml, findlib, camlp5 }:

let
  start_script = ''
    #!/bin/sh
    cd "$out/lib/hol_light"
    exec ${ocaml}/bin/ocaml -I \`${camlp5}/bin/camlp5 -where\` -init make.ml
  '';
in

stdenv.mkDerivation rec {
  name     = "hol_light-${version}";
  version  = "218";

  src = fetchsvn {
    url = http://hol-light.googlecode.com/svn/trunk;
    rev = version;
    sha256 = "0lidcadyjpyqd2iw90gfrm8hb6g9gpabp54c0ps6z0lb6hdzln74";
  };

  buildInputs = [ ocaml findlib camlp5 ];

  installPhase = ''
    mkdir -p "$out/lib/hol_light" "$out/bin"
    cp -a  . $out/lib/hol_light
    echo "${start_script}" > "$out/bin/hol_light"
    chmod a+x "$out/bin/hol_light"
  '';

  meta = with stdenv.lib; {
    description = "Interactive theorem prover based on Higher-Order Logic";
    homepage    = http://www.cl.cam.ac.uk/~jrh13/hol-light/;
    license     = licenses.bsd2;
    platforms   = platforms.unix;
    maintainers = with maintainers; [ thoughtpolice z77z vbgl ];
  };
}

Update HOL Light to svn r232 (2015-05-31)

{ stdenv, fetchsvn, writeScript, ocaml, findlib, camlp5 }:

let
  start_script = ''
    #!/bin/sh
    cd "$out/lib/hol_light"
    exec ${ocaml}/bin/ocaml -I \`${camlp5}/bin/camlp5 -where\` -init make.ml
  '';
in

stdenv.mkDerivation rec {
  name     = "hol_light-${version}";
  version  = "232";

  src = fetchsvn {
    url = http://hol-light.googlecode.com/svn/trunk;
    rev = version;
    sha256 = "1cips2cb5wqxb6n2qi28af2ap1vhklqbhjy7pnifgz4dilkz10m8";
  };

  buildInputs = [ ocaml findlib camlp5 ];

  installPhase = ''
    mkdir -p "$out/lib/hol_light" "$out/bin"
    cp -a  . $out/lib/hol_light
    echo "${start_script}" > "$out/bin/hol_light"
    chmod a+x "$out/bin/hol_light"
  '';

  meta = with stdenv.lib; {
    description = "Interactive theorem prover based on Higher-Order Logic";
    homepage    = http://www.cl.cam.ac.uk/~jrh13/hol-light/;
    license     = licenses.bsd2;
    platforms   = platforms.unix;
    maintainers = with maintainers; [ thoughtpolice z77z vbgl ];
  };
}


{stdenv, fetchFromGitHub, cmake, pkgconfig, bzip2, libxml2, libzip, boost, lua, luabind, tbb, expat}:

stdenv.mkDerivation rec {
  name = "osrm-backend-${version}";
  version = "5.14.3";

  src = fetchFromGitHub {
    rev = "v${version}";
    owner  = "Project-OSRM";
    repo   = "osrm-backend";
    sha256 = "1ajgybjx7g6qzddavab8bj7il7wn5wy24nivjj5rk84mfbi71s5v";
  };

  buildInputs = [ cmake pkgconfig bzip2 libxml2 libzip boost lua luabind tbb expat];

  postInstall = "mkdir -p $out/share/osrm-backend && cp -r ../profiles $out/share/osrm-backend/profiles";

  meta = {
    homepage = https://github.com/Project-OSRM/osrm-backend/wiki;
    description = "Open Source Routing Machine computes shortest paths in a graph. It was designed to run well with map data from the Openstreetmap Project";
    license = stdenv.lib.licenses.bsd2;
    maintainers = with stdenv.lib.maintainers;[ erictapen ];
    platforms = stdenv.lib.platforms.linux;
  };
}

Use nativeBuildInputs for compile-time-only deps

{stdenv, fetchFromGitHub, cmake, pkgconfig, bzip2, libxml2, libzip, boost, lua, luabind, tbb, expat}:

stdenv.mkDerivation rec {
  name = "osrm-backend-${version}";
  version = "5.14.3";

  src = fetchFromGitHub {
    rev = "v${version}";
    owner  = "Project-OSRM";
    repo   = "osrm-backend";
    sha256 = "1ajgybjx7g6qzddavab8bj7il7wn5wy24nivjj5rk84mfbi71s5v";
  };

  nativeBuildInputs = [ cmake pkgconfig ];
  buildInputs = [ bzip2 libxml2 libzip boost lua luabind tbb expat ];

  postInstall = "mkdir -p $out/share/osrm-backend && cp -r ../profiles $out/share/osrm-backend/profiles";

  meta = {
    homepage = https://github.com/Project-OSRM/osrm-backend/wiki;
    description = "Open Source Routing Machine computes shortest paths in a graph. It was designed to run well with map data from the Openstreetmap Project";
    license = stdenv.lib.licenses.bsd2;
    maintainers = with stdenv.lib.maintainers;[ erictapen ];
    platforms = stdenv.lib.platforms.linux;
  };
}


{ config, pkgs, ... }:

{
  environment.systemPackages = with pkgs; [
    # Editors
    (neovim.override { vimAlias = true; })
    # emacs # in user config, due to customization

    # Development
    gitAndTools.tig

    # Admin
    acpi
    file
    gptfdisk
    gparted
    htop
    pciutils
    tree
    wget
    termite.terminfo

    # Nix
    nix-repl
    nix-prefetch-scripts
    #strategoPackages018.strategoxt # It's broken
  ];

  nix = {
    # Don't use unstable if there is a schema change!
    #package = pkgs.nixUnstable;
    useSandbox = true;
    binaryCaches = [
      "http://cache.nixos.org/"
      "https://nixcache.reflex-frp.org"
    ];
    trustedBinaryCaches = [
      "https://hydra.nixos.org/"
      "http://hydra.cryp.to"
    ];
    binaryCachePublicKeys = [
      "ryantrinkle.com-1:JJiAKaRv9mWgpVAz8dwewnZe0AzzEAzPkagE9SP5NWI="
    ];
  };
}

Make some binary caches use HTTPS

{ config, pkgs, ... }:

{
  environment.systemPackages = with pkgs; [
    # Editors
    (neovim.override { vimAlias = true; })
    # emacs # in user config, due to customization

    # Development
    gitAndTools.tig

    # Admin
    acpi
    file
    gptfdisk
    gparted
    htop
    pciutils
    tree
    wget
    termite.terminfo

    # Nix
    nix-repl
    nix-prefetch-scripts
    #strategoPackages018.strategoxt # It's broken
  ];

  nix = {
    # Don't use unstable if there is a schema change!
    #package = pkgs.nixUnstable;
    useSandbox = true;
    binaryCaches = [
      "https://cache.nixos.org/"
      "https://nixcache.reflex-frp.org"
    ];
    trustedBinaryCaches = [
      "https://hydra.nixos.org/"
      "https://hydra.cryp.to"
    ];
    binaryCachePublicKeys = [
      "ryantrinkle.com-1:JJiAKaRv9mWgpVAz8dwewnZe0AzzEAzPkagE9SP5NWI="
    ];
  };
}


{ lib, buildGoModule, fetchFromGitHub, makeWrapper, iptables, iproute }:

buildGoModule rec {
  pname = "tailscale";
  version = "1.0.5";

  src = fetchFromGitHub {
    owner = "tailscale";
    repo = "tailscale";
    rev = "v${version}";
    sha256 = "0ib2s694kf5iz5hvrlzfs80z0931dhva7yir80crq0pji9y4rp7b";
  };

  nativeBuildInputs = [ makeWrapper ];

  CGO_ENABLED = 0;

  vendorSha256 = "0l9lzwwvshg9a2kmmq1cvvlaxncbas78a9hjhvjjar89rjr2k2sv";

  doCheck = false;

  subPackages = [ "cmd/tailscale" "cmd/tailscaled" ];

  postInstall = ''
    wrapProgram $out/bin/tailscaled --prefix PATH : ${
      lib.makeBinPath [ iproute iptables ]
    }
  '';

  meta = with lib; {
    homepage = "https://tailscale.com";
    description = "The node agent for Tailscale, a mesh VPN built on WireGuard";
    platforms = platforms.linux;
    license = licenses.bsd3;
    maintainers = with maintainers; [ danderson mbaillie ];
  };
}

Include version in build flags

{ lib, buildGoModule, fetchFromGitHub, makeWrapper, iptables, iproute }:

buildGoModule rec {
  pname = "tailscale";
  version = "1.0.5";

  src = fetchFromGitHub {
    owner = "tailscale";
    repo = "tailscale";
    rev = "v${version}";
    sha256 = "0ib2s694kf5iz5hvrlzfs80z0931dhva7yir80crq0pji9y4rp7b";
  };

  nativeBuildInputs = [ makeWrapper ];

  CGO_ENABLED = 0;

  vendorSha256 = "0l9lzwwvshg9a2kmmq1cvvlaxncbas78a9hjhvjjar89rjr2k2sv";

  doCheck = false;

  subPackages = [ "cmd/tailscale" "cmd/tailscaled" ];

  preBuild = ''
    export buildFlagsArray=(
      -tags="xversion"
      -ldflags="-X tailscale.com/version.LONG=${version} -X tailscale.com/version.SHORT=${version}"
    )
  '';

  postInstall = ''
    wrapProgram $out/bin/tailscaled --prefix PATH : ${
      lib.makeBinPath [ iproute iptables ]
    }
  '';

  meta = with lib; {
    homepage = "https://tailscale.com";
    description = "The node agent for Tailscale, a mesh VPN built on WireGuard";
    platforms = platforms.linux;
    license = licenses.bsd3;
    maintainers = with maintainers; [ danderson mbaillie ];
  };
}


{ stdenv, fetchurl, pythonPackages, pygobject, gst_python
, gst_plugins_good, gst_plugins_base
}:

pythonPackages.buildPythonPackage rec {
  name = "mopidy-${version}";

  version = "0.18.3";

  src = fetchurl {
    url = "https://github.com/mopidy/mopidy/archive/v${version}.tar.gz";
    sha256 = "0b8ss6qjzj1pawd8469i5310ily3rad0ashfy87vdyj6xdyfyp0q";
  };

  propagatedBuildInputs = with pythonPackages; [
    gst_python pygobject pykka cherrypy ws4py gst_plugins_base gst_plugins_good
  ];

  # There are no tests
  doCheck = false;

  postInstall = ''
    wrapProgram $out/bin/mopidy \
      --prefix GST_PLUGIN_SYSTEM_PATH : "$GST_PLUGIN_SYSTEM_PATH"
  '';

  meta = with stdenv.lib; {
    homepage = http://www.mopidy.com/;
    description = ''
      An extensible music server that plays music from local disk, Spotify,
      SoundCloud, Google Play Music, and more.
    '';
    license = licenses.asl20;
    maintainers = [ maintainers.rickynils ];
    hydraPlatforms = [];
  };
}

Update from 0.18.3 to 0.19.0

{ stdenv, fetchurl, pythonPackages, pygobject, gst_python
, gst_plugins_good, gst_plugins_base
}:

pythonPackages.buildPythonPackage rec {
  name = "mopidy-${version}";

  version = "0.19.0";

  src = fetchurl {
    url = "https://github.com/mopidy/mopidy/archive/v${version}.tar.gz";
    sha256 = "10cnc1bipr0brk7478201cgm71lp5bci3qiaadyxv9hhcn0nmn9b";
  };

  propagatedBuildInputs = with pythonPackages; [
    gst_python pygobject pykka tornado gst_plugins_base gst_plugins_good
  ];

  # There are no tests
  doCheck = false;

  postInstall = ''
    wrapProgram $out/bin/mopidy \
      --prefix GST_PLUGIN_SYSTEM_PATH : "$GST_PLUGIN_SYSTEM_PATH"
  '';

  meta = with stdenv.lib; {
    homepage = http://www.mopidy.com/;
    description = ''
      An extensible music server that plays music from local disk, Spotify,
      SoundCloud, Google Play Music, and more.
    '';
    license = licenses.asl20;
    maintainers = [ maintainers.rickynils ];
    hydraPlatforms = [];
  };
}


{stdenv, fetchurl, openssl, cyrus_sasl, db, groff}:

stdenv.mkDerivation rec {
  name = "openldap-2.4.38";

  src = fetchurl {
    url = "ftp://ftp.nl.uu.net/pub/unix/db/openldap/openldap-release/${name}.tgz";
    sha256 = "1l8zng86alhcmmmw09r1c4dzl7yvk6dy5fq9zia96pgck4srl848";
  };

  buildInputs = [ openssl cyrus_sasl db groff ];

  configureFlags =
    [ "--enable-overlays"
    ] ++ stdenv.lib.optional (openssl == null) "--without-tls"
      ++ stdenv.lib.optional (cyrus_sasl == null) "--without-cyrus-sasl";

  dontPatchELF = 1; # !!!

  meta = {
    homepage = "http://www.openldap.org/";
    description = "An open source implementation of the Lightweight Directory Access Protocol";
    maintainers = stdenv.lib.maintainers.mornfall;
  };
}

Update from 2.4.38 to 2.4.39

{stdenv, fetchurl, openssl, cyrus_sasl, db, groff}:

stdenv.mkDerivation rec {
  name = "openldap-2.4.39";

  src = fetchurl {
    url = "ftp://ftp.nl.uu.net/pub/unix/db/openldap/openldap-release/${name}.tgz";
    sha256 = "19zq9dc7dl03wmqd11fbsdii1npyq1vlicl3nxbfygqh8xrwhrw2";
  };

  buildInputs = [ openssl cyrus_sasl db groff ];

  configureFlags =
    [ "--enable-overlays"
    ] ++ stdenv.lib.optional (openssl == null) "--without-tls"
      ++ stdenv.lib.optional (cyrus_sasl == null) "--without-cyrus-sasl";

  dontPatchELF = 1; # !!!

  meta = {
    homepage = "http://www.openldap.org/";
    description = "An open source implementation of the Lightweight Directory Access Protocol";
    maintainers = stdenv.lib.maintainers.mornfall;
  };
}


{stdenv, fetchurl, pkgconfig, tcl, gtk}:

stdenv.mkDerivation {
  name = "xchat-2.8.4";
  src = fetchurl {
    url = http://www.xchat.org/files/source/2.8/xchat-2.8.4.tar.bz2;
    sha256 = "0qyx6rdvnjwy52amcmkjj134sysfkzbyv7b66vjsla3i8yg9lnpr";
  };
  buildInputs = [pkgconfig tcl gtk];
  configureFlags = "--disable-nls";

  meta = {
    homepage = http://www.xchat.org;
  };
}

Update of XChat to 2.8.8; old version 2.8.4 does not compile.

{stdenv, fetchurl, pkgconfig, tcl, gtk}:

stdenv.mkDerivation {
  name = "xchat-2.8.8";
  src = fetchurl {
    url = http://www.xchat.org/files/source/2.8/xchat-2.8.8.tar.bz2;
    sha256 = "0d6d69437b5e1e45f3e66270fe369344943de8a1190e498fafa5296315a27db0";
  };
  buildInputs = [pkgconfig tcl gtk];
  configureFlags = "--disable-nls";

  meta = {
    homepage = http://www.xchat.org;
  };
}


{ stdenv, pkgs, fetchurl }:

stdenv.mkDerivation rec {
  version = "1.5.11";
  name = "haproxy-${version}";

  src = fetchurl {
    url = "http://haproxy.1wt.eu/download/1.5/src/${name}.tar.gz";
    sha256 = "1gwkyy06c8bw5vcjv82hai554zrd415jjsb1iafg01c4k1ia8nlb";
  };

  buildInputs = [ ];

  # TODO: make it work on darwin/bsd as well
  preConfigure = ''
    export makeFlags="TARGET=linux2628 PREFIX=$out"
  '';

  meta = {
    description = "Reliable, high performance TCP/HTTP load balancer";
    longDescription = ''
      HAProxy is a free, very fast and reliable solution offering high
      availability, load balancing, and proxying for TCP and HTTP-based
      applications. It is particularly suited for web sites crawling under very
      high loads while needing persistence or Layer7 processing. Supporting
      tens of thousands of connections is clearly realistic with todays
      hardware.
    '';
    homepage = http://haproxy.1wt.eu;
    maintainers = [ stdenv.lib.maintainers.garbas ];
    platforms = stdenv.lib.platforms.linux;
    /* TODO license = [
       stdenv.lib.licenses.gpl2
       stdenv.lib.licenses.lgpl21
    ];*/
  };
}

Add SSL support to HAProxy

{ stdenv, pkgs, fetchurl, openssl }:

stdenv.mkDerivation rec {
  version = "1.5.11";
  name = "haproxy-${version}";

  src = fetchurl {
    url = "http://haproxy.1wt.eu/download/1.5/src/${name}.tar.gz";
    sha256 = "1gwkyy06c8bw5vcjv82hai554zrd415jjsb1iafg01c4k1ia8nlb";
  };

  buildInputs = [ openssl ];

  # TODO: make it work on darwin/bsd as well
  preConfigure = ''
    export makeFlags="TARGET=linux2628 PREFIX=$out USE_OPENSSL=yes"
  '';

  meta = {
    description = "Reliable, high performance TCP/HTTP load balancer";
    longDescription = ''
      HAProxy is a free, very fast and reliable solution offering high
      availability, load balancing, and proxying for TCP and HTTP-based
      applications. It is particularly suited for web sites crawling under very
      high loads while needing persistence or Layer7 processing. Supporting
      tens of thousands of connections is clearly realistic with todays
      hardware.
    '';
    homepage = http://haproxy.1wt.eu;
    maintainers = [ stdenv.lib.maintainers.garbas ];
    platforms = stdenv.lib.platforms.linux;
    /* TODO license = [
       stdenv.lib.licenses.gpl2
       stdenv.lib.licenses.lgpl21
    ];*/
  };
}


{ stdenv, fetchurl, perl }:

stdenv.mkDerivation rec {
  name = "mbedtls-1.3.11";

  src = fetchurl {
    url = "https://polarssl.org/download/${name}-gpl.tgz";
    sha256 = "1js1lk6hvw9l3nhjhnhzfazfbnlcmk229hmnlm7jli3agc1979b7";
  };

  nativeBuildInputs = [ perl ];

  postPatch = ''
    patchShebangs .
  '';

  makeFlags = [
    "SHARED=1"
  ];

  installFlags = [
    "DESTDIR=\${out}"
  ];

  postInstall = ''
    rm -f $out/lib/lib{mbedtls.so.8,polarssl.{a,so}}
    ln -s libmbedtls.so $out/lib/libmbedtls.so.8
    ln -s libmbedtls.so $out/lib/libpolarssl.so
    ln -s libmbedtls.a $out/lib/libpolarssl.a
  '';

  doCheck = true;

  meta = with stdenv.lib; {
    homepage = https://polarssl.org/;
    description = "Portable cryptographic and SSL/TLS library, aka polarssl";
    license = licenses.gpl3;
    platforms = platforms.all;
    maintainers = with maintainers; [ wkennington ];
  };
}

Remove postInstall workarounds that were fixed upstream

{ stdenv, fetchurl, perl }:

stdenv.mkDerivation rec {
  name = "mbedtls-1.3.11";

  src = fetchurl {
    url = "https://polarssl.org/download/${name}-gpl.tgz";
    sha256 = "1js1lk6hvw9l3nhjhnhzfazfbnlcmk229hmnlm7jli3agc1979b7";
  };

  nativeBuildInputs = [ perl ];

  postPatch = ''
    patchShebangs .
  '';

  makeFlags = [
    "SHARED=1"
  ];

  installFlags = [
    "DESTDIR=\${out}"
  ];

  doCheck = true;

  meta = with stdenv.lib; {
    homepage = https://polarssl.org/;
    description = "Portable cryptographic and SSL/TLS library, aka polarssl";
    license = licenses.gpl3;
    platforms = platforms.all;
    maintainers = with maintainers; [ wkennington ];
  };
}


{ stdenv, fetchurl, nasm, perl }:

stdenv.mkDerivation rec {
  name = "syslinux-4.02";

  src = fetchurl {
    url = "mirror://kernel/linux/utils/boot/syslinux/4.xx/${name}.tar.bz2";
    sha256 = "0zrk6magnrfa7nmdk2rll7xaym9rapwqqgy0wdh3cfscjmcw9kwm";
  };

  patches = [ ./perl-deps.patch ];

  buildInputs = [ nasm perl ];

  preBuild =
    ''
      substituteInPlace gpxe/src/Makefile.housekeeping --replace /bin/echo $(type -P echo)
      makeFlagsArray=(BINDIR=$out/bin SBINDIR=$out/sbin LIBDIR=$out/lib INCDIR=$out/include DATADIR=$out/share MANDIR=$out/share/man PERL=perl)
    '';
}

Advance syslinux version to 4.03.

{ stdenv, fetchurl, nasm, perl }:

stdenv.mkDerivation rec {
  name = "syslinux-4.03";

  src = fetchurl {
    url = "mirror://kernel/linux/utils/boot/syslinux/4.xx/${name}.tar.bz2";
    sha256 = "0f6s1cnibw6j0jh9bn5qsx3vsar9l1w9b3xfjkvzglgr4kinfmf6";
  };

  patches = [ ./perl-deps.patch ];

  buildInputs = [ nasm perl ];

  preBuild =
    ''
      substituteInPlace gpxe/src/Makefile.housekeeping --replace /bin/echo $(type -P echo)
      substituteInPlace gpxe/src/Makefile --replace /usr/bin/perl $(type -P perl)
      makeFlagsArray=(BINDIR=$out/bin SBINDIR=$out/sbin LIBDIR=$out/lib INCDIR=$out/include DATADIR=$out/share MANDIR=$out/share/man PERL=perl)
    '';
}


{stdenv, fetchurl, libxml2}:

stdenv.mkDerivation {
  name = "libxslt-1.1.24";

  src = fetchurl {
    url = ftp://xmlsoft.org/libxml2/libxslt-1.1.24.tar.gz;
    sha256 = "c0c10944841e9a79f29d409c6f8da0d1b1af0403eb3819c82c788dfa6a180b3e";
  };

  buildInputs = [libxml2];

  postInstall = ''
    ensureDir $out/nix-support
    ln -s ${libxml2}/nix-support/setup-hook $out/nix-support/
  '';

  meta = {
    homepage = http://xmlsoft.org/XSLT/;
    description = "A C library and tools to do XSL transformations";
  };
}

Allow libxslt to get extra arguments as it is inside deepOverride from webkit

{stdenv, fetchurl, libxml2, ...}:

stdenv.mkDerivation {
  name = "libxslt-1.1.24";

  src = fetchurl {
    url = ftp://xmlsoft.org/libxml2/libxslt-1.1.24.tar.gz;
    sha256 = "c0c10944841e9a79f29d409c6f8da0d1b1af0403eb3819c82c788dfa6a180b3e";
  };

  buildInputs = [libxml2];

  postInstall = ''
    ensureDir $out/nix-support
    ln -s ${libxml2}/nix-support/setup-hook $out/nix-support/
  '';

  meta = {
    homepage = http://xmlsoft.org/XSLT/;
    description = "A C library and tools to do XSL transformations";
  };
}


{ stdenv, fetchurl, pkgconfig, attr, acl, zlib, libuuid, e2fsprogs, lzo
, asciidoc, xmlto, docbook_xml_dtd_45, docbook_xsl, libxslt
}:

let version = "4.8.3"; in

stdenv.mkDerivation rec {
  name = "btrfs-progs-${version}";

  src = fetchurl {
    url = "mirror://kernel/linux/kernel/people/kdave/btrfs-progs/btrfs-progs-v${version}.tar.xz";
    sha256 = "1wlflrygnpndppil9g12pk184f75g9qx1lkr0x1gijigglqhr9n1";
  };

  buildInputs = [
    pkgconfig attr acl zlib libuuid e2fsprogs lzo
    asciidoc xmlto docbook_xml_dtd_45 docbook_xsl libxslt
  ];

  # gcc bug with -O1 on ARM with gcc 4.8
  # This should be fine on all platforms so apply universally
  patchPhase = "sed -i s/-O1/-O2/ configure";

  meta = with stdenv.lib; {
    description = "Utilities for the btrfs filesystem";
    homepage = https://btrfs.wiki.kernel.org/;
    license = licenses.gpl2;
    maintainers = with maintainers; [ nckx raskin wkennington ];
    platforms = platforms.linux;
  };
}

Revert "btrfs-progs: 4.8.2 -> 4.8.3"

{ stdenv, fetchurl, pkgconfig, attr, acl, zlib, libuuid, e2fsprogs, lzo
, asciidoc, xmlto, docbook_xml_dtd_45, docbook_xsl, libxslt
}:

let version = "4.8.2"; in

stdenv.mkDerivation rec {
  name = "btrfs-progs-${version}";

  src = fetchurl {
    url = "mirror://kernel/linux/kernel/people/kdave/btrfs-progs/btrfs-progs-v${version}.tar.xz";
    sha256 = "0pswcfmdnfc586770h74abp67gn2xv8fd46vxlimnmn837sj7h41";
  };

  buildInputs = [
    pkgconfig attr acl zlib libuuid e2fsprogs lzo
    asciidoc xmlto docbook_xml_dtd_45 docbook_xsl libxslt
  ];

  # gcc bug with -O1 on ARM with gcc 4.8
  # This should be fine on all platforms so apply universally
  patchPhase = "sed -i s/-O1/-O2/ configure";

  meta = with stdenv.lib; {
    description = "Utilities for the btrfs filesystem";
    homepage = https://btrfs.wiki.kernel.org/;
    license = licenses.gpl2;
    maintainers = with maintainers; [ nckx raskin wkennington ];
    platforms = platforms.linux;
  };
}


{ stdenv, fetchFromGitHub, cmake, emacs, neovim-libvterm }:

let
  emacsSources = stdenv.mkDerivation {
    name = emacs.name + "-sources";
    src = emacs.src;

    configurePhase = ":";
    dontBuild = true;
    doCheck = false;
    fixupPhase = ":";

    installPhase = ''
      mkdir -p $out
      cp -a * $out
    '';

  };

in stdenv.mkDerivation rec {
  name = "emacs-libvterm-${version}";
  version = "unstable-2017-11-24";

  src = fetchFromGitHub {
    owner = "akermu";
    repo = "emacs-libvterm";
    rev = "829ae86f60c3a54048804997edffa161c77a2f4b";
    sha256 = "1xb24kpvypvskh4vr3b45nl2m2vsczcr9rnsr2sjzf32mnapyjnp";
  };

  nativeBuildInputs = [ cmake ];
  buildInputs = [ emacs neovim-libvterm ];

  cmakeFlags = [ "-DEMACS_SOURCE=${emacsSources}" ];

  installPhase = ''
    install -d $out/share/emacs/site-lisp
    install ../*.el $out/share/emacs/site-lisp
    install ../*.so $out/share/emacs/site-lisp
  '';
}

Fix build (flipped over libvterm-neovim)

{ stdenv, fetchFromGitHub, cmake, emacs, libvterm-neovim }:

let
  emacsSources = stdenv.mkDerivation {
    name = emacs.name + "-sources";
    src = emacs.src;

    configurePhase = ":";
    dontBuild = true;
    doCheck = false;
    fixupPhase = ":";

    installPhase = ''
      mkdir -p $out
      cp -a * $out
    '';

  };

in stdenv.mkDerivation rec {
  name = "emacs-libvterm-${version}";
  version = "unstable-2017-11-24";

  src = fetchFromGitHub {
    owner = "akermu";
    repo = "emacs-libvterm";
    rev = "829ae86f60c3a54048804997edffa161c77a2f4b";
    sha256 = "1xb24kpvypvskh4vr3b45nl2m2vsczcr9rnsr2sjzf32mnapyjnp";
  };

  nativeBuildInputs = [ cmake ];
  buildInputs = [ emacs libvterm-neovim ];

  cmakeFlags = [ "-DEMACS_SOURCE=${emacsSources}" ];

  installPhase = ''
    install -d $out/share/emacs/site-lisp
    install ../*.el $out/share/emacs/site-lisp
    install ../*.so $out/share/emacs/site-lisp
  '';
}


{ stdenv, fetchurl, glib, pkgconfig, perl, intltool }:
stdenv.mkDerivation {
  name = "libgtop-2.32.0";

  src = fetchurl {
    url = mirror://gnome/sources/libgtop/2.32/libgtop-2.32.0.tar.xz;
    sha256 = "13hpml2vfm23816qggr5fvxj75ndb1dq4rgmi7ik6azj69ij8hw4";
  };

  propagatedBuildInputs = [ glib ];
  nativeBuildInputs = [ pkgconfig perl intltool gobjectIntrospection ];
}

Add gobjectIntrospection to the scope

{ stdenv, fetchurl, glib, pkgconfig, perl, intltool, gobjectIntrospection }:
stdenv.mkDerivation {
  name = "libgtop-2.32.0";

  src = fetchurl {
    url = mirror://gnome/sources/libgtop/2.32/libgtop-2.32.0.tar.xz;
    sha256 = "13hpml2vfm23816qggr5fvxj75ndb1dq4rgmi7ik6azj69ij8hw4";
  };

  propagatedBuildInputs = [ glib ];
  nativeBuildInputs = [ pkgconfig perl intltool gobjectIntrospection ];
}


{ stdenv, buildPythonPackage, isPy3k, fetchPypi,
  paramiko, pycurl, ajpy, pyopenssl, cx_oracle, mysqlclient,
  psycopg2, pycrypto, dnspython, ipy, pysnmp, pyasn1 }:

buildPythonPackage rec {
  pname = "patator";
  version = "0.9";
  disabled = !(isPy3k);

  src = fetchPypi {
    inherit pname version;
    sha256 = "68cb24bdc3042ee0d47a288b19a8b99a6c54bdbd4ddf0c5817d9b9ac0a0d8a15";
  };

  propagatedBuildInputs = [
    paramiko
    pycurl
    ajpy
    pyopenssl
    cx_oracle
    mysqlclient
    psycopg2
    pycrypto
    dnspython
    ipy
    pysnmp
    pyasn1
  ];

  # No tests provided by patator
  doCheck = false;

  meta = with stdenv.lib; {
    description = "multi-purpose brute-forcer";
    homepage = "https://github.com/lanjelot/patator";
    license = licenses.gpl2;
    maintainers = with maintainers; [ y0no ];
  };
}

Revert "python: patator: 0.7 -> 0.9"

{ stdenv, buildPythonPackage, isPy3k, fetchPypi,
  paramiko, pycurl, ajpy, pyopenssl, cx_oracle, mysqlclient,
  psycopg2, pycrypto, dnspython, ipy, pysnmp, pyasn1 }:

buildPythonPackage rec {
  pname = "patator";
  version = "0.7";
  disabled = !(isPy3k);

  src = fetchPypi {
    inherit pname version;
    sha256 = "335e432e6cc591437e316ba8c1da935484ca39fc79e595ccf60ccd9166e965f1";
  };

  propagatedBuildInputs = [
    paramiko
    pycurl
    ajpy
    pyopenssl
    cx_oracle
    mysqlclient
    psycopg2
    pycrypto
    dnspython
    ipy
    pysnmp
    pyasn1
  ];

  # No tests provided by patator
  doCheck = false;

  meta = with stdenv.lib; {
    description = "multi-purpose brute-forcer";
    homepage = "https://github.com/lanjelot/patator";
    license = licenses.gpl2;
    maintainers = with maintainers; [ y0no ];
  };
}


{ stdenv, lib, pkgconfig, gnome3 }:

stdenv.mkDerivation {
  name = "clipsnoop";
  src = lib.cleanSource ./.;
  buildInputs = [ pkgconfig gnome3.gtkmm ];
  makeFlags = "PREFIX=$(out)";
}

Update nix derivation for move of gtkmm3 out of gnome

{ stdenv, lib, pkgconfig, boost, gtkmm3 }:

stdenv.mkDerivation {
  name = "clipsnoop";
  src = lib.cleanSource ./.;
  nativeBuildInputs = [ pkgconfig ];
  buildInputs = [ gtkmm3 boost ];
  makeFlags = "PREFIX=$(out)";
}


{ stdenv
, fetchurl
, gettext

, dbus
, gnutls
, libfilezilla
, pugixml
, sqlite
, wxGTK
, xdg-utils
}:

stdenv.mkDerivation rec {
  name = "filezilla-${version}";
  version = "3.16.1";

  src = fetchurl {
    url = "mirror://sourceforge/project/filezilla/FileZilla_Client/${version}/FileZilla_${version}_src.tar.bz2";
    sha256 = "3b046f854cea17f9c14d6a12aa5d2e027908c6535f44a068cfed5da9eddddda8";
  };

  nativeBuildInputs = [
    gettext
  ];

  buildInputs = [
    dbus
    gnutls
    libfilezilla
    pugixml
    sqlite
    wxGTK
    xdg-utils
  ];

  configureFlags = [
    "--disable-manualupdatecheck"
  ];

  meta = with stdenv.lib; {
    homepage = http://filezilla-project.org/;
    description = "Graphical FTP, FTPS and SFTP client";
    license = licenses.gpl2;
    maintainers = with maintainers; [
      wkennington
    ];
    platforms = with platforms;
      x86_64-linux;
  };
}

Use the given hash files

{ stdenv
, fetchurl
, gettext

, dbus
, gnutls
, libfilezilla
, pugixml
, sqlite
, wxGTK
, xdg-utils
}:

let
  version = "3.16.1";
  baseFileUrl = "mirror://sourceforge/project/filezilla/FileZilla_Client/${version}/FileZilla_${version}";
in
stdenv.mkDerivation rec {
  name = "filezilla-${version}";

  src = fetchurl {
    url = "${baseFileUrl}_src.tar.bz2";
    sha512Url = "${baseFileUrl}.sha512";
    sha256 = "3b046f854cea17f9c14d6a12aa5d2e027908c6535f44a068cfed5da9eddddda8";
  };

  nativeBuildInputs = [
    gettext
  ];

  buildInputs = [
    dbus
    gnutls
    libfilezilla
    pugixml
    sqlite
    wxGTK
    xdg-utils
  ];

  configureFlags = [
    "--disable-manualupdatecheck"
  ];

  meta = with stdenv.lib; {
    homepage = http://filezilla-project.org/;
    description = "Graphical FTP, FTPS and SFTP client";
    license = licenses.gpl2;
    maintainers = with maintainers; [
      wkennington
    ];
    platforms = with platforms;
      x86_64-linux;
  };
}


{ stdenv, fetchurl, pkgconfig, ncurses, systemd }:

stdenv.mkDerivation rec {
  name = "procps-ng-3.3.10";

  src = fetchurl {
    url = "mirror://sourceforge/procps-ng/${name}.tar.xz";
    sha256 = "013z4rzy3p5m1zp6mmynpblv0c6zlcn91pw4k2vymz2djyc6ybm0";
  };

  buildInputs = [ pkgconfig ncurses systemd ];

  makeFlags = "usrbin_execdir=$(out)/bin";

  enableParallelBuilding = true;

  crossAttrs = {
    CC = stdenv.cross.config + "-gcc";
  };

  # Too red
  configureFlags = [
    "--disable-modern-top"
    "--enable-watch8bit"
    "--with-systemd"
    "--enable-skill"
    "--enable-oomem"
    "--enable-sigwinch"
  ];

  meta = with stdenv.lib; {
    homepage = http://sourceforge.net/projects/procps-ng/;
    description = "Utilities that give information about processes using the /proc filesystem";
    priority = 10; # less than coreutils, which also provides "kill" and "uptime"
    maintainers = with maintainers; [ wkennington ];
    license = licenses.gpl2;
    platforms = platforms.linux;
  };
}

Revert "procps-ng: Refactor a bit"

{ lib, stdenv, fetchurl, ncurses }:

stdenv.mkDerivation {
  name = "procps-3.3.10";

  src = fetchurl {
    url = mirror://sourceforge/procps-ng/procps-ng-3.3.10.tar.xz;
    sha256 = "013z4rzy3p5m1zp6mmynpblv0c6zlcn91pw4k2vymz2djyc6ybm0";
  };

  buildInputs = [ ncurses ];

  makeFlags = "usrbin_execdir=$(out)/bin";

  enableParallelBuilding = true;

  crossAttrs = {
    CC = stdenv.cross.config + "-gcc";
  };

  # Too red
  configureFlags = [ "--disable-modern-top" ];

  meta = {
    homepage = http://sourceforge.net/projects/procps-ng/;
    description = "Utilities that give information about processes using the /proc filesystem";
    priority = 10; # less than coreutils, which also provides "kill" and "uptime"
    license = lib.licenses.gpl2;
    platforms = lib.platforms.linux;
  };
}


with import (fetchTarball https://github.com/nixos/nixpkgs/tarball/be0071c2d7053e994b30c6be373b87e9e8178b8e) { };

stdenv.mkDerivation {
    name = "dev-shell";
    src = null;
    buildInputs = [ nodejs-8_x ];
}

Upgrade to latest node (by upgrading to what's the latest nixpkgs).

with import (fetchTarball https://github.com/nixos/nixpkgs/tarball/5c7cc53cb720cff0911bbb1c7846216d13d846a7) { };

stdenv.mkDerivation {
    name = "dev-shell";
    src = null;
    buildInputs = [ nodejs-8_x ];
}


{ lib
, stdenv
, buildDunePackage
, fetchFromGitHub
, cmdliner
, ctypes
, dune-configurator
, npy
, ocaml-compiler-libs
, ppx_custom_printf
, ppx_expect
, ppx_sexp_conv
, sexplib
, stdio
, pytorch
}:

buildDunePackage rec {
  pname = "torch";
  version = "0.14";

  useDune2 = true;

  minimalOCamlVersion = "4.08";

  src = fetchFromGitHub {
    owner = "LaurentMazare";
    repo   = "ocaml-${pname}";
    rev    = version;
    sha256 = "sha256:039anfvzsalbqi5cdp95bbixcwr2ngharihgd149hcr0wa47y700";
  };

  buildInputs = [ dune-configurator ];

  propagatedBuildInputs = [
    cmdliner
    ctypes
    npy
    ocaml-compiler-libs
    pytorch
    pytorch.dev
    ppx_custom_printf
    ppx_expect
    ppx_sexp_conv
    sexplib
    stdio
  ];

  preBuild = "export LIBTORCH=${pytorch.dev}/";

  doCheck = !stdenv.isAarch64;
  checkPhase = "dune runtest";

  meta = with lib; {
    inherit (src.meta) homepage;
    description = "Ocaml bindings to Pytorch";
    maintainers = [ maintainers.bcdarwin ];
    license = licenses.asl20;
  };
}

Mark as broken with pytorch >= 1.11

{ lib
, stdenv
, buildDunePackage
, fetchFromGitHub
, cmdliner
, ctypes
, dune-configurator
, npy
, ocaml-compiler-libs
, ppx_custom_printf
, ppx_expect
, ppx_sexp_conv
, sexplib
, stdio
, pytorch
}:

buildDunePackage rec {
  pname = "torch";
  version = "0.14";

  useDune2 = true;

  minimalOCamlVersion = "4.08";

  src = fetchFromGitHub {
    owner = "LaurentMazare";
    repo   = "ocaml-${pname}";
    rev    = version;
    sha256 = "sha256:039anfvzsalbqi5cdp95bbixcwr2ngharihgd149hcr0wa47y700";
  };

  buildInputs = [ dune-configurator ];

  propagatedBuildInputs = [
    cmdliner
    ctypes
    npy
    ocaml-compiler-libs
    pytorch
    pytorch.dev
    ppx_custom_printf
    ppx_expect
    ppx_sexp_conv
    sexplib
    stdio
  ];

  preBuild = "export LIBTORCH=${pytorch.dev}/";

  doCheck = !stdenv.isAarch64;
  checkPhase = "dune runtest";

  meta = with lib; {
    inherit (src.meta) homepage;
    description = "Ocaml bindings to Pytorch";
    maintainers = [ maintainers.bcdarwin ];
    license = licenses.asl20;
    broken = lib.versionAtLeast pytorch.version "1.11";
  };
}


{ stdenv, fetchurl
, # FreeType supports sub-pixel rendering.  This is patented by
  # Microsoft, so it is disabled by default.  This option allows it to
  # be enabled.  See http://www.freetype.org/patents.html.
  useEncumberedCode ? false
}:

stdenv.mkDerivation rec {
  name = "freetype-2.4.4";

  src = fetchurl {
    url = "mirror://sourceforge/freetype/${name}.tar.bz2";
    sha256 = "1vqg93473j6jma1bxms7mczk32j8is0g9inkcmmmqdsdvk3q30jb";
  };

  configureFlags = "--disable-static";

  NIX_CFLAGS_COMPILE = stdenv.lib.optionalString useEncumberedCode
    "-DFT_CONFIG_OPTION_SUBPIXEL_RENDERING=1";

  # The asm for armel is written with the 'asm' keyword.
  CFLAGS = stdenv.lib.optionalString (stdenv.system == "armv5tel-linux") "-std=gnu99";

  meta = {
    description = "A font rendering engine";
    homepage = http://www.freetype.org/;
    license = "GPLv2+"; # or the FreeType License (BSD + advertising clause)
  };
}

Add dependency on GNU Make on FreeBSD.

{ stdenv, fetchurl, gnumake
, # FreeType supports sub-pixel rendering.  This is patented by
  # Microsoft, so it is disabled by default.  This option allows it to
  # be enabled.  See http://www.freetype.org/patents.html.
  useEncumberedCode ? false
}:

stdenv.mkDerivation (rec {
  name = "freetype-2.4.4";

  src = fetchurl {
    url = "mirror://sourceforge/freetype/${name}.tar.bz2";
    sha256 = "1vqg93473j6jma1bxms7mczk32j8is0g9inkcmmmqdsdvk3q30jb";
  };

  configureFlags = "--disable-static";

  NIX_CFLAGS_COMPILE = stdenv.lib.optionalString useEncumberedCode
    "-DFT_CONFIG_OPTION_SUBPIXEL_RENDERING=1";

  # The asm for armel is written with the 'asm' keyword.
  CFLAGS = stdenv.lib.optionalString (stdenv.system == "armv5tel-linux") "-std=gnu99";

  meta = {
    description = "A font rendering engine";
    homepage = http://www.freetype.org/;
    license = "GPLv2+"; # or the FreeType License (BSD + advertising clause)
  };
}

//

# FreeType requires GNU Make, which is not part of stdenv on FreeBSD.
(if stdenv.system == "i686-freebsd"
 then { buildInputs = [ gnumake ]; }
 else {}))


{ linkFarm, fetchFromGitHub, lib, runCommandLocal, stdenv }:
with lib.attrsets;
let
  isFetcherAttr = attr: _: attr != "optional" && attr != "fetch";
  mkPlugin = name: attrs:
    let fetcher =
          if attrs.fetch == "github" then fetchFromGitHub
          else abort("unknown value for ${name}.fetch: ${attrs.fetch}");
        fetcherAttrs =
          ((filterAttrs isFetcherAttr attrs) // { inherit name; });
    in {
      inherit name;
      path = fetcher fetcherAttrs;
      optional = attrs.optional or false;
    };
  plugins = mapAttrsToList mkPlugin (import ./vim-plugins.nix);
  env = {
    startup = linkFarm "vim-plugins-startup"
      (builtins.filter (p: ! p.optional) plugins);
    optional = linkFarm "vim-plugins-optional"
      (builtins.filter (p: p.optional) plugins);
  };
in
runCommandLocal "vim-plugins" env ''
    mkdir -p $out
    ln -s $startup $out/start
    ln -s $optional $out/opt
  ''

Use linkFarm again, why not

{ linkFarm, fetchFromGitHub, lib, stdenv }:
with lib.attrsets;
let
  isFetcherAttr = attr: _: attr != "optional" && attr != "fetch";
  mkPlugin = name: attrs:
    let fetcher =
          if attrs.fetch == "github" then fetchFromGitHub
          else abort("unknown value for ${name}.fetch: ${attrs.fetch}");
        fetcherAttrs =
          ((filterAttrs isFetcherAttr attrs) // { inherit name; });
    in {
      inherit name;
      path = fetcher fetcherAttrs;
      optional = attrs.optional or false;
    };
  plugins = mapAttrsToList mkPlugin (import ./vim-plugins.nix);
in
linkFarm "vim-plugins" [ {
    name = "start";
    path = linkFarm "vim-plugins-startup" (builtins.filter (p: ! p.optional) plugins);
  } {
    name = "opt";
    path = linkFarm "vim-plugins-optional" (builtins.filter (p: p.optional) plugins);
  } ]


{ pkgs, ... }:

let old_dots = import ./_dotfiles-dir.nix;

in {
  home.packages = [
    pkgs.gnupg # for email and git
  ];

  services.gpg-agent = {
    enable = true;
    defaultCacheTtl = 1800;
    enableSshSupport = true;
  };

  xdg = {
    # todo: move this into home-manager configuration
    configFile."gnupg/gpg.conf".source = old_dots + /gnupg/gpg.conf;
  };
}

Set GPG pinentry to curses.

{ pkgs, ... }:

let old_dots = import ./_dotfiles-dir.nix;

in {
  home.packages = [
    pkgs.gnupg            # for email and git
    pkgs.pinentry         # cli pin entry
  ];

  services.gpg-agent = {
    enable = true;
    defaultCacheTtl = 1800;
    enableSshSupport = true;
    extraConfig = "pinentry-program ${pkgs.pinentry}/bin/pinentry";
  };

  xdg = {
    # todo: move this into home-manager configuration
    configFile."gnupg/gpg.conf".source = old_dots + /gnupg/gpg.conf;
  };
}


{ mkDerivation, reflex, reflex-dom, file-embed, cabal-macosx, jsaddle-warp, jsaddle-webkit2gtk, jsaddle-wkwebview, ghc, stdenv, darwin
, buildPackages
}:

mkDerivation {
  pname = "reflex-todomvc";
  version = "0.1";
  src = builtins.filterSource (path: type: !(builtins.elem (baseNameOf path) [ ".git" "dist" ])) ./.;
  isExecutable = true;
  isLibrary = true;
  buildDepends = [
    reflex
    reflex-dom
    file-embed
    cabal-macosx
  ] ++ (if ghc.isGhcjs or false then [
  ] else if stdenv.hostPlatform.isiOS then [
    jsaddle-wkwebview
    buildPackages.darwin.apple_sdk.libs.xpc
    (buildPackages.osx_sdk or null)
  ] else if stdenv.hostPlatform.isMacOS then [
    jsaddle-wkwebview
    jsaddle-warp
  ] else [
    jsaddle-webkit2gtk
    jsaddle-warp
  ]);
  postInstall = stdenv.lib.optionalString (ghc.isGhcjs or false) ''
    rm "$out/bin/reflex-todomvc" || true # This is not designed to be run from node, so don't let it be
  '';
  license = null;
}

Make cabal-macos a setup dependency on the nix level.

{ mkDerivation, reflex, reflex-dom, file-embed, cabal-macosx, jsaddle-warp, jsaddle-webkit2gtk, jsaddle-wkwebview, ghc, stdenv, darwin
, buildPackages
}:

mkDerivation {
  pname = "reflex-todomvc";
  version = "0.1";
  src = builtins.filterSource (path: type: !(builtins.elem (baseNameOf path) [ ".git" "dist" ])) ./.;
  isExecutable = true;
  isLibrary = true;
  buildTools = [
    cabal-macosx
  ];
  buildDepends = [
    reflex
    reflex-dom
    file-embed
  ] ++ (if ghc.isGhcjs or false then [
  ] else if stdenv.hostPlatform.isiOS then [
    jsaddle-wkwebview
    buildPackages.darwin.apple_sdk.libs.xpc
    (buildPackages.osx_sdk or null)
  ] else if stdenv.hostPlatform.isMacOS then [
    jsaddle-wkwebview
    jsaddle-warp
  ] else [
    jsaddle-webkit2gtk
    jsaddle-warp
  ]);
  postInstall = stdenv.lib.optionalString (ghc.isGhcjs or false) ''
    rm "$out/bin/reflex-todomvc" || true # This is not designed to be run from node, so don't let it be
  '';
  license = null;
}


{ stdenv
, buildPythonPackage
, fetchPypi
, pytz
, six
}:

buildPythonPackage rec {
  pname = "pg8000";
  version = "1.13.2";

  src = fetchPypi {
    inherit pname version;
    sha256 = "eebcb4176a7e407987e525a07454882f611985e0becb2b73f76efb93bbdc0aab";
  };

  propagatedBuildInputs = [ pytz six ];

  meta = with stdenv.lib; {
    homepage = https://github.com/tlocke/pg8000;
    description = "PostgreSQL interface library, for asyncio";
    maintainers = with maintainers; [ domenkozar ];
    platforms = platforms.unix;
  };

}

Revert "python: pg8000: 1.12.5 -> 1.13.2"

{ stdenv
, buildPythonPackage
, fetchPypi
, pytz
, six
}:

buildPythonPackage rec {
  pname = "pg8000";
  version = "1.12.5";

  src = fetchPypi {
    inherit pname version;
    sha256 = "1yc3knh28cx3rjb2ifg5kmqqa78yyyw2gzzslbm9fj0mzh5aq1sx";
  };

  propagatedBuildInputs = [ pytz six ];

  meta = with stdenv.lib; {
    homepage = https://github.com/tlocke/pg8000;
    description = "PostgreSQL interface library, for asyncio";
    maintainers = with maintainers; [ domenkozar ];
    platforms = platforms.unix;
  };

}


{ stdenv, fetchurl, pcre, libxml2, zlib, attr, bzip2, which, file, openssl }:

stdenv.mkDerivation {
  name = "lighttpd-1.4.32";

  src = fetchurl {
    url = http://download.lighttpd.net/lighttpd/releases-1.4.x/lighttpd-1.4.32.tar.xz;
    sha256 = "1hgd9bi4mrak732h57na89lqg58b1kkchnddij9gawffd40ghs0k";
  };

  buildInputs = [ pcre libxml2 zlib attr bzip2 which file openssl ];

  configureFlags = "--with-openssl --with-openssl-libs=${openssl}";

  preConfigure = ''
    sed -i "s:/usr/bin/file:${file}/bin/file:g" configure
  '';

  meta = with stdenv.lib; {
    description = "Lightweight high-performance web server";
    homepage = http://www.lighttpd.net/;
    license = "BSD";
    platforms = platforms.linux;
    maintainers = [maintainers.bjornfor];
  };
}

Allow to compile with magnet support.

{ stdenv, fetchurl, pkgconfig, pcre, libxml2, zlib, attr, bzip2, which, file
, openssl, enableMagnet ? false, lua5 ? null
}:

assert enableMagnet -> lua5 != null;

stdenv.mkDerivation {
  name = "lighttpd-1.4.32";

  src = fetchurl {
    url = http://download.lighttpd.net/lighttpd/releases-1.4.x/lighttpd-1.4.32.tar.xz;
    sha256 = "1hgd9bi4mrak732h57na89lqg58b1kkchnddij9gawffd40ghs0k";
  };

  buildInputs = [ pkgconfig pcre libxml2 zlib attr bzip2 which file openssl ]
             ++ stdenv.lib.optional enableMagnet lua5;

  configureFlags = [ "--with-openssl" ]
                ++ stdenv.lib.optional enableMagnet "--with-lua";

  preConfigure = ''
    sed -i "s:/usr/bin/file:${file}/bin/file:g" configure
  '';

  meta = with stdenv.lib; {
    description = "Lightweight high-performance web server";
    homepage = http://www.lighttpd.net/;
    license = "BSD";
    platforms = platforms.linux;
    maintainers = [maintainers.bjornfor];
  };
}


{ cabal, glib, gtk, gtk2hsBuildtools, gtkglext, pango }:

cabal.mkDerivation (self: {
  pname = "gtkglext";
  version = "0.12.5.0";
  sha256 = "1xhalcb85cpswdpqxx64fxpmyqq7iakgaczjrbr25fp0h1glshhk";
  buildDepends = [ glib gtk pango ];
  buildTools = [ gtk2hsBuildtools ];
  pkgconfigDepends = [ gtkglext ];
  meta = {
    homepage = "http://projects.haskell.org/gtk2hs/";
    description = "Binding to the GTK+ OpenGL Extension";
    license = self.stdenv.lib.licenses.lgpl21;
    platforms = self.ghc.meta.platforms;
  };
})

Revert "haskell-gtkglext: update to version 0.12.5.0"

{ pkgs, cabal, gtk, gtk2hsBuildtools, pangox_compat }:

cabal.mkDerivation (self: {
  pname = "gtkglext";
  version = "0.12.5.0";
  sha256 = "1xhalcb85cpswdpqxx64fxpmyqq7iakgaczjrbr25fp0h1glshhk";
  buildDepends = [ gtk ];
  buildTools = [ gtk2hsBuildtools ];
  pkgconfigDepends = [ pkgs.gnome2.gtkglext pangox_compat ];
  meta = {
    homepage = "http://projects.haskell.org/gtk2hs/";
    description = "Binding to the GTK+ OpenGL Extension";
    license = self.stdenv.lib.licenses.lgpl21;
    platforms = self.ghc.meta.platforms;
  };
})


{ pkgs ? import <nixpkgs> {} }:

(pkgs.buildFHSUserEnv {
  name = "candela-build-env";
  targetPkgs = pkgs: (with pkgs;
    [
      cairo
      fontconfig
      freetype
      git
      gnumake
      libpng
      nodejs
      pixman
      pkgconfig
      python
      vim
      zlib
    ]);
  runScript = "zsh";
}).env

Enable image testing to work in nix-shell

{ pkgs ? import <nixpkgs> {} }:

(pkgs.buildFHSUserEnv {
  name = "candela-build-env";
  targetPkgs = pkgs: (with pkgs;
    [
      alsaLib
      atk
      cairo
      cups
      dbus
      expat
      fontconfig
      freetype
      gdk_pixbuf
      glib
      git
      gnumake
      gtk
      libnotify
      libpng
      nodejs
      nspr
      nss
      pango
      pixman
      pkgconfig
      python
      udev
      zlib
    ]) ++ (with pkgs.gnome;
    [
      GConf
    ]) ++ (with pkgs.xorg;
    [
      libX11
      libXcomposite
      libXcursor
      libXdamage
      libXext
      libXfixes
      libXi
      libXrandr
      libXrender
      libXtst
    ]);
  runScript = "zsh";
}).env


{ stdenv, fetchurl, zlib, readline, libossp_uuid, openssl }:

with stdenv.lib;

let version = "9.4.4"; in

stdenv.mkDerivation rec {
  name = "postgresql-${version}";

  src = fetchurl {
    url = "mirror://postgresql/source/v${version}/${name}.tar.bz2";
    sha256 = "04q07g209y99xzjh88y52qpvz225rxwifv8nzp3bxzfni2bdk3jk";
  };

  buildInputs = [ zlib readline openssl ]
                ++ optionals (!stdenv.isDarwin) [ libossp_uuid ];

  enableParallelBuilding = true;

  makeFlags = [ "world" ];

  configureFlags = [ "--with-openssl" ]
                   ++ optional (!stdenv.isDarwin) "--with-ossp-uuid";

  patches = [ ./disable-resolve_symlinks-94.patch ./less-is-more.patch ];

  installTargets = [ "install-world" ];

  LC_ALL = "C";

  passthru = {
    inherit readline;
    psqlSchema = "9.4";
  };

  meta = with stdenv.lib; {
    homepage = http://www.postgresql.org/;
    description = "A powerful, open source object-relational database system";
    license = licenses.postgresql;
    maintainers = [ maintainers.ocharles ];
    platforms = platforms.unix;
    hydraPlatforms = platforms.linux;
  };
}

Enable uuid-ossp in Postgres 9.4 on Darwin

{ stdenv, fetchurl, zlib, readline, libossp_uuid, openssl }:

with stdenv.lib;

let version = "9.4.4"; in

stdenv.mkDerivation rec {
  name = "postgresql-${version}";

  src = fetchurl {
    url = "mirror://postgresql/source/v${version}/${name}.tar.bz2";
    sha256 = "04q07g209y99xzjh88y52qpvz225rxwifv8nzp3bxzfni2bdk3jk";
  };

  buildInputs = [ zlib readline openssl ]
                ++ optionals (!stdenv.isDarwin) [ libossp_uuid ];

  enableParallelBuilding = true;

  makeFlags = [ "world" ];

  configureFlags = [ "--with-openssl" ]
                   ++ optional (stdenv.isDarwin)  "--with-uuid=e2fs"
                   ++ optional (!stdenv.isDarwin) "--with-ossp-uuid";

  patches = [ ./disable-resolve_symlinks-94.patch ./less-is-more.patch ];

  installTargets = [ "install-world" ];

  LC_ALL = "C";

  passthru = {
    inherit readline;
    psqlSchema = "9.4";
  };

  meta = with stdenv.lib; {
    homepage = http://www.postgresql.org/;
    description = "A powerful, open source object-relational database system";
    license = licenses.postgresql;
    maintainers = [ maintainers.ocharles ];
    platforms = platforms.unix;
    hydraPlatforms = platforms.linux;
  };
}


{stdenv, fetchurl, ocaml, findlib}:

stdenv.mkDerivation {
  name = "ocaml-extlib-1.5.2";

  src = fetchurl {
    url = "http://ocaml-extlib.googlecode.com/files/extlib-1.5.2.tar.gz";
    sha256 = "ca6d69adeba4242ce41c02a23746ba1e464c0bbec66e2d16b02c3c6e85dc10aa";
  };

  buildInputs = [ocaml findlib];

  createFindlibDestdir = true;

  configurePhase = "true";

  meta = {
    homepage = "http://code.google.com/p/ocaml-extlib/";
    description = "Enhancements to the OCaml Standard Library modules";
    license = "LGPL";
    platforms = ocaml.meta.platforms;
  };
}

Fix of the ocaml extlib expression. The native object files were not installed. Turns out that also the 'opt' make target must be run besides 'all'.

{stdenv, fetchurl, ocaml, findlib}:

stdenv.mkDerivation {
  name = "ocaml-extlib-1.5.2";

  src = fetchurl {
    url = "http://ocaml-extlib.googlecode.com/files/extlib-1.5.2.tar.gz";
    sha256 = "ca6d69adeba4242ce41c02a23746ba1e464c0bbec66e2d16b02c3c6e85dc10aa";
  };

  buildInputs = [ocaml findlib];

  createFindlibDestdir = true;

  buildPhase = ''
    make all
    make opt
  '';

  meta = {
    homepage = "http://code.google.com/p/ocaml-extlib/";
    description = "Enhancements to the OCaml Standard Library modules";
    license = "LGPL";
    platforms = ocaml.meta.platforms;
  };
}


{}:
with import ./. {};
let inherit (nixpkgs.lib) optionals;
    getOtherDeps = reflexPlatform: [
      reflexPlatform.nixpkgs.cabal2nix
      reflexPlatform.ghc.cabal2nix
    ] ++ builtins.concatLists (map
      (crossPkgs: optionals (crossPkgs != null) [
        crossPkgs.buildPackages.haskellPackages.cabal2nix
      ]) [
        reflexPlatform.nixpkgsCross.ios.aarch64
        reflexPlatform.nixpkgsCross.android.aarch64
        reflexPlatform.nixpkgsCross.android.aarch32
      ]
    );

in nixpkgs.lib.genAttrs cacheTargetSystems (system:
  let
    reflexPlatform = (import ./. { inherit system; });
  in {
    tryReflexShell = reflexPlatform.tryReflexShell;
    ghcjsReflexTodomvc = ghcjs.reflex-todomvc;
    ghcReflexTodomvc = ghc.reflex-todomvc;
  } // nixpkgs.lib.listToAttrs
    (builtins.map (drv: { inherit (drv) name; value = drv; }) (getOtherDeps reflexPlatform))
) // {
  benchmark = import ./scripts/benchmark.nix {};
  inherit iosReflexTodomvc androidReflexTodomvc;
}

Add ghcjs build products to hydra

{}:
with import ./. {};
let inherit (nixpkgs.lib) optionals;
    getOtherDeps = reflexPlatform: [
      reflexPlatform.nixpkgs.cabal2nix
      reflexPlatform.ghc.cabal2nix
    ] ++ builtins.concatLists (map
      (crossPkgs: optionals (crossPkgs != null) [
        crossPkgs.buildPackages.haskellPackages.cabal2nix
      ]) [
        reflexPlatform.nixpkgsCross.ios.aarch64
        reflexPlatform.nixpkgsCross.android.aarch64
        reflexPlatform.nixpkgsCross.android.aarch32
      ]
    );

in nixpkgs.lib.genAttrs cacheTargetSystems (system:
  let
    reflexPlatform = (import ./. { inherit system; });
  in {
    tryReflexShell = reflexPlatform.tryReflexShell;
    ghcjsReflexTodomvc = ghcjs.reflex-todomvc.overrideAttrs (attrs: {
      postInstall = ''
        ${attrs.postInstall or ""}
        mkdir -p $out/nix-support
        echo $out/bin/reflex-todomvc.jsexe >> $out/nix-support/hydra-build-products
      '';
    });
    ghcReflexTodomvc = ghc.reflex-todomvc;
  } // nixpkgs.lib.listToAttrs
    (builtins.map (drv: { inherit (drv) name; value = drv; }) (getOtherDeps reflexPlatform))
) // {
  benchmark = import ./scripts/benchmark.nix {};
  inherit iosReflexTodomvc androidReflexTodomvc;
}


{ stdenv, fetchurl, pythonPackages, gettext, pyqt4
, pkgconfig, libdiscid, libofa, ffmpeg }:

pythonPackages.buildPythonPackage rec {
  name = "picard-${version}";
  namePrefix = "";
  version = "1.2";

  src = fetchurl {
    url = "http://ftp.musicbrainz.org/pub/musicbrainz/picard/${name}.tar.gz";
    md5 = "d1086687b7f7b0d359a731b1a25e7b66";
  };

  buildInputs = [
    pkgconfig
    ffmpeg
    libofa
    gettext
  ];

  propagatedBuildInputs = [
    pythonPackages.mutagen
    pyqt4
    libdiscid
  ];

  configurePhase = ''
    python setup.py config
  '';

  buildPhase = ''
    python setup.py build
  '';

  installPhase = ''
    python setup.py install --prefix="$out"
  '';

  doCheck = false;

  meta = {
    homepage = "http://musicbrainz.org/doc/MusicBrainz_Picard";
    description = "The official MusicBrainz tagger";
    license = stdenv.lib.licenses.gpl2;
  };
}

Patch in path of AcoustED fingerprinter.

{ stdenv, fetchurl, pythonPackages, gettext, pyqt4
, pkgconfig, libdiscid, libofa, ffmpeg, acoustidFingerprinter
}:

pythonPackages.buildPythonPackage rec {
  name = "picard-${version}";
  namePrefix = "";
  version = "1.2";

  src = fetchurl {
    url = "http://ftp.musicbrainz.org/pub/musicbrainz/picard/${name}.tar.gz";
    md5 = "d1086687b7f7b0d359a731b1a25e7b66";
  };

  postPatch = let
    fpr = "${acoustidFingerprinter}/bin/acoustid_fpcalc";
  in ''
    sed -ri -e 's|(TextOption.*"acoustid_fpcalc"[^"]*")[^"]*|\1${fpr}|' \
      picard/ui/options/fingerprinting.py
  '';

  buildInputs = [
    pkgconfig
    ffmpeg
    libofa
    gettext
  ];

  propagatedBuildInputs = [
    pythonPackages.mutagen
    pyqt4
    libdiscid
  ];

  configurePhase = ''
    python setup.py config
  '';

  buildPhase = ''
    python setup.py build
  '';

  installPhase = ''
    python setup.py install --prefix="$out"
  '';

  doCheck = false;

  meta = {
    homepage = "http://musicbrainz.org/doc/MusicBrainz_Picard";
    description = "The official MusicBrainz tagger";
    license = stdenv.lib.licenses.gpl2;
  };
}


a@{fetchsvn, libxml2, gtk, curl, pkgconfig, lib, ...} :
let
  fetchsvn = a.fetchsvn;

  buildInputs = with a; [
    libxml2 gtk curl pkgconfig
  ];
in
rec {
  src = fetchsvn {
    url = http://svn.openstreetmap.org/applications/rendering/gosmore;
    sha256 = "0ds61gl75rnzvm0hj9papl5sfcgdv4310df9ch7x9rifssfli9zm";
    rev = "24178";
  } + "/";

  inherit buildInputs;
  configureFlags = [];

  /* doConfigure should be removed if not needed */
  phaseNames = ["doConfigure" "doMakeInstall"];

  name = "gosmore-r21657";
  meta = {
    description = "Open Street Map viewer";
    maintainers = [
      a.lib.maintainers.raskin
    ];
    platforms = a.lib.platforms.linux;
  };
}

Fix gosmore build - curl dropped curl/types.h

a@{fetchsvn, libxml2, gtk, curl, pkgconfig, lib, ...} :
let
  fetchsvn = a.fetchsvn;

  buildInputs = with a; [
    libxml2 gtk curl pkgconfig
  ];
in
rec {
  src = fetchsvn {
    url = http://svn.openstreetmap.org/applications/rendering/gosmore;
    sha256 = "0ds61gl75rnzvm0hj9papl5sfcgdv4310df9ch7x9rifssfli9zm";
    rev = "24178";
  } + "/";

  inherit buildInputs;
  configureFlags = [];

  /* doConfigure should be removed if not needed */
  phaseNames = ["fixCurlIncludes" "doConfigure" "doMakeInstall"];

  fixCurlIncludes = a.fullDepEntry ''
    sed -e '/curl.types.h/d' -i *.{c,h,hpp,cpp}
  '' ["minInit" "doUnpack"];

  name = "gosmore-r21657";
  meta = {
    description = "Open Street Map viewer";
    maintainers = [
      a.lib.maintainers.raskin
    ];
    platforms = a.lib.platforms.linux;
  };
}


{ stdenv, fetchurl, fixedPoint ? false }:

stdenv.mkDerivation rec {
  name = "libopus-1.0.2";

  src = fetchurl {
    url = "http://downloads.xiph.org/releases/opus/opus-1.0.2.tar.gz";
    sha256 = "12npbkrcwvh3fl9l18cwrxwg269cg2j6j7876cc9q0axxvdmwqfs";
  };

  configureFlags = stdenv.lib.optionalString fixedPoint "--enable-fixed-point";

  meta = {
    description = "Open, royalty-free, highly versatile audio codec";
    license = "BSD";
    homepage = http://www.opus-codec.org/;
  };
}

Upgrade opus from 1.0.2 -> 1.0.3

{ stdenv, fetchurl, fixedPoint ? false }:

stdenv.mkDerivation rec {
  name = "libopus-1.0.3";

  src = fetchurl {
    url = "http://downloads.xiph.org/releases/opus/opus-1.0.3.tar.gz";
    sha256 = "175l7hv7d03c4iz60g185nqvwrabc39ksil0d7g07i6vjaf0h6hr";
  };

  configureFlags = stdenv.lib.optionalString fixedPoint "--enable-fixed-point";

  meta = {
    description = "Open, royalty-free, highly versatile audio codec";
    license = "BSD";
    homepage = http://www.opus-codec.org/;
  };
}


{ stdenv, fetchsvn, writeScript, ocaml, findlib, camlp5 }:

let
  start_script = ''
    #!/bin/sh
    cd "$out/lib/hol_light"
    exec ${ocaml}/bin/ocaml -I \`${camlp5}/bin/camlp5 -where\` -init make.ml
  '';
in

stdenv.mkDerivation rec {
  name     = "hol_light-${version}";
  version  = "205";

  src = fetchsvn {
    url = http://hol-light.googlecode.com/svn/trunk;
    rev = version;
    sha256 = "1qnk3fkfr6f74nd8wsi84s9kg872cw766sa15a2ldlhs9ma76chj";
  };

  buildInputs = [ ocaml findlib camlp5 ];

  installPhase = ''
    mkdir -p "$out/lib/hol_light" "$out/bin"
    cp -a  . $out/lib/hol_light
    echo "${start_script}" > "$out/bin/hol_light"
    chmod a+x "$out/bin/hol_light"
  '';

  meta = with stdenv.lib; {
    description = "Interactive theorem prover based on Higher-Order Logic";
    homepage    = http://www.cl.cam.ac.uk/~jrh13/hol-light/;
    license     = licenses.bsd2;
    platforms   = platforms.unix;
    maintainers = with maintainers; [ thoughtpolice z77z vbgl ];
  };
}

Update HOL Light to r218

{ stdenv, fetchsvn, writeScript, ocaml, findlib, camlp5 }:

let
  start_script = ''
    #!/bin/sh
    cd "$out/lib/hol_light"
    exec ${ocaml}/bin/ocaml -I \`${camlp5}/bin/camlp5 -where\` -init make.ml
  '';
in

stdenv.mkDerivation rec {
  name     = "hol_light-${version}";
  version  = "218";

  src = fetchsvn {
    url = http://hol-light.googlecode.com/svn/trunk;
    rev = version;
    sha256 = "0lidcadyjpyqd2iw90gfrm8hb6g9gpabp54c0ps6z0lb6hdzln74";
  };

  buildInputs = [ ocaml findlib camlp5 ];

  installPhase = ''
    mkdir -p "$out/lib/hol_light" "$out/bin"
    cp -a  . $out/lib/hol_light
    echo "${start_script}" > "$out/bin/hol_light"
    chmod a+x "$out/bin/hol_light"
  '';

  meta = with stdenv.lib; {
    description = "Interactive theorem prover based on Higher-Order Logic";
    homepage    = http://www.cl.cam.ac.uk/~jrh13/hol-light/;
    license     = licenses.bsd2;
    platforms   = platforms.unix;
    maintainers = with maintainers; [ thoughtpolice z77z vbgl ];
  };
}


# This module defines a small NixOS installation CD.  It does not
# contain any graphical stuff.

{config, pkgs, ...}:

{
  require = [./installation-cd-base.nix];

  installer.configModule = "./nixos/modules/installer/cd-dvd/installation-cd-minimal.nix";

  # allow using of firmware without rebuilding the system
  hardware.firmware = [ "/root/my-firmware" ];

  # Don't include X libraries.
  services.sshd.forwardX11 = false;
  services.dbus.enable = false; # depends on libX11
  services.hal.enable = false; # depends on dbus
  fonts.enableFontConfig = false;
  fonts.enableCoreFonts = false;
}

Revert "add /root/my-firmware to the list of firmware directories"

# This module defines a small NixOS installation CD.  It does not
# contain any graphical stuff.

{config, pkgs, ...}:

{
  require = [./installation-cd-base.nix];

  installer.configModule = "./nixos/modules/installer/cd-dvd/installation-cd-minimal.nix";

  # Don't include X libraries.
  services.sshd.forwardX11 = false;
  services.dbus.enable = false; # depends on libX11
  services.hal.enable = false; # depends on dbus
  fonts.enableFontConfig = false;
  fonts.enableCoreFonts = false;
}


{ stdenv, fetchurl, groff, rake, makeWrapper }:

stdenv.mkDerivation rec {
  name = "hub-${version}";
  version = "1.10.6";

  src = fetchurl {
    url = "https://github.com/github/hub/archive/v${version}.tar.gz";
    sha256 = "0vfl1iq1927in81vd7zvp7yqqzay7pciyj87s83qfxrqyjpxn609";
  };

  buildInputs = [ rake makeWrapper ];

  installPhase = ''
    rake install "prefix=$out"
  '';

  fixupPhase = ''
    wrapProgram $out/bin/hub --prefix PATH : ${groff}/bin
  '';

  meta = {
    description = "A GitHub specific wrapper for git";
    homepage = "http://defunkt.io/hub/";
    license = stdenv.lib.licenses.mit;
  };
}

Update from 1.10.6 -> 1.11.1

{ stdenv, fetchurl, groff, rake, makeWrapper }:

stdenv.mkDerivation rec {
  name = "hub-${version}";
  version = "1.11.1";

  src = fetchurl {
    url = "https://github.com/github/hub/archive/v${version}.tar.gz";
    sha256 = "09wqxxzgrgcx6p3n3bhrb5ka3194qfwnli5j3frv37448hx6wd4n";
  };

  buildInputs = [ rake makeWrapper ];

  installPhase = ''
    rake install "prefix=$out"
  '';

  fixupPhase = ''
    wrapProgram $out/bin/hub --prefix PATH : ${groff}/bin
  '';

  meta = {
    description = "A GitHub specific wrapper for git";
    homepage = "http://defunkt.io/hub/";
    license = stdenv.lib.licenses.mit;
  };
}


{ fetchurl, stdenv, pkgconfig, python, gstreamer
  , gst_plugins_base, pygtk
}:

stdenv.mkDerivation rec {
  name = "gst-python-0.10.22";

  src = fetchurl {
    urls = [
      "${meta.homepage}/src/gst-python/${name}.tar.bz2"
      "mirror://gentoo/distfiles/${name}.tar.bz2"
      ];
    sha256 = "0y1i4n5m1diljqr9dsq12anwazrhbs70jziich47gkdwllcza9lg";
  };

  buildInputs =
    [ pkgconfig gst_plugins_base pygtk ]
    ;

  propagatedBuildInputs = [ gstreamer python ];

  meta = {
    homepage = http://gstreamer.freedesktop.org;

    description = "Python bindings for GStreamer";

    license = stdenv.lib.licenses.lgpl2Plus;
  };
}

Reduce dependency footprint of gst-python.

{ fetchurl, stdenv, pkgconfig, python, gstreamer
, gst_plugins_base, pygobject
}:

stdenv.mkDerivation rec {
  name = "gst-python-0.10.22";

  src = fetchurl {
    urls = [
      "${meta.homepage}/src/gst-python/${name}.tar.bz2"
      "mirror://gentoo/distfiles/${name}.tar.bz2"
      ];
    sha256 = "0y1i4n5m1diljqr9dsq12anwazrhbs70jziich47gkdwllcza9lg";
  };

  buildInputs =
    [ pkgconfig gst_plugins_base pygobject ]
    ;

  propagatedBuildInputs = [ gstreamer python ];

  meta = {
    homepage = http://gstreamer.freedesktop.org;

    description = "Python bindings for GStreamer";

    license = stdenv.lib.licenses.lgpl2Plus;
  };
}


{ stdenv
, buildPythonPackage
, fetchPypi
, python
, wrapPython
, unzip
, callPackage
, bootstrapped-pip
}:

buildPythonPackage rec {
  pname = "setuptools";
  version = "41.2.0";
  format = "other";

  src = fetchPypi {
    inherit pname version;
    extension = "zip";
    sha256 = "66b86bbae7cc7ac2e867f52dc08a6bd064d938bac59dfec71b9b565dd36d6012";
  };

  # There is nothing to build
  dontBuild = true;

  nativeBuildInputs = [ bootstrapped-pip ];

  installPhase = ''
      dst=$out/${python.sitePackages}
      mkdir -p $dst
      export PYTHONPATH="$dst:$PYTHONPATH"
      ${python.pythonForBuild.interpreter} setup.py install --prefix=$out
      wrapPythonPrograms
  '';

  # Adds setuptools to nativeBuildInputs causing infinite recursion.
  catchConflicts = false;

  # Requires pytest, causing infinite recursion.
  doCheck = false;

  meta = with stdenv.lib; {
    description = "Utilities to facilitate the installation of Python packages";
    homepage = https://pypi.python.org/pypi/setuptools;
    license = with licenses; [ psfl zpl20 ];
    platforms = python.meta.platforms;
    priority = 10;
  };
}

Remove windows files and make reproducible

{ stdenv
, buildPythonPackage
, fetchPypi
, python
, wrapPython
, unzip
, callPackage
, bootstrapped-pip
, lib
, pipInstallHook
, setuptoolsBuildHook
}:

buildPythonPackage rec {
  pname = "setuptools";
  version = "41.2.0";
  # Because of bootstrapping we don't use the setuptoolsBuildHook that comes with format="setuptools" directly.
  # Instead, we override it to remove setuptools to avoid a circular dependency.
  # The same is done for pip and the pipInstallHook.
  format = "other";

  src = fetchPypi {
    inherit pname version;
    extension = "zip";
    sha256 = "66b86bbae7cc7ac2e867f52dc08a6bd064d938bac59dfec71b9b565dd36d6012";
  };

  nativeBuildInputs = [
    bootstrapped-pip
    (pipInstallHook.override{pip=null;})
    (setuptoolsBuildHook.override{setuptools=null; wheel=null;})
  ];

  preBuild = lib.strings.optionalString (!stdenv.hostPlatform.isWindows) ''
    export SETUPTOOLS_INSTALL_WINDOWS_SPECIFIC_FILES=0
  '';

  pipInstallFlags = [ "--ignore-installed" ];

  # Adds setuptools to nativeBuildInputs causing infinite recursion.
  catchConflicts = false;

  # Requires pytest, causing infinite recursion.
  doCheck = false;

  meta = with stdenv.lib; {
    description = "Utilities to facilitate the installation of Python packages";
    homepage = https://pypi.python.org/pypi/setuptools;
    license = with licenses; [ psfl zpl20 ];
    platforms = python.meta.platforms;
    priority = 10;
  };
}


{
  packageOverrides = pkgs: with pkgs; rec {
    myProfile = writeText "my-profile" ''
      export PATH=$HOME/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/sbin:/bin:/usr/sbin:/usr/bin
      export MANPATH=$HOME/.nix-profile/share/man:/nix/var/nix/profiles/default/share/man:/usr/share/man
    '';
    myPackages = pkgs.buildEnv {
      name = "my-packages";
      paths = [
        aspell
        coreutils
        gnupg
        curl
        git
        jq
        skim
        bat
        exa
        lsd
        tig
        ripgrep
        fd
        tree
        neovim
        stow
        xclip
        pass
        tmux
        alacritty
        elmPackages.elm
        elmPackages.elm-format
        elmPackages.elm-test
        elmPackages.elm-analyse
        elmPackages.elm-language-server
        nodejs-13_x
        yarn
        emacs
        htop
      ];
      pathsToLink = [ "/share" "/bin" "/Applications" ];
      extraOutputsToInstall = [ "man" "doc" ];
    };
  };
}

Remove elm and neovim packages

{
  packageOverrides = pkgs: with pkgs; rec {
    myProfile = writeText "my-profile" ''
      export PATH=$HOME/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/sbin:/bin:/usr/sbin:/usr/bin
      export MANPATH=$HOME/.nix-profile/share/man:/nix/var/nix/profiles/default/share/man:/usr/share/man
    '';
    myPackages = pkgs.buildEnv {
      name = "my-packages";
      paths = [
        aspell
        coreutils
        gnupg
        curl
        git
        jq
        skim
        bat
        exa
        lsd
        tig
        ripgrep
        fd
        tree
        python3Packages.pynvim
        stow
        xclip
        pass
        tmux
        alacritty
        nodejs-13_x
        yarn
        emacs
        htop
        bandwhich
        broot
      ];
      pathsToLink = [ "/share" "/bin" "/Applications" ];
      extraOutputsToInstall = [ "man" "doc" ];
    };
  };
}


{ stdenv, fetchurl, lib, pkg-config, alsaLib, libogg, libpulseaudio ? null, libjack2 ? null }:

stdenv.mkDerivation rec {
  pname = "alsa-plugins";
  version = "1.2.2";

  src = fetchurl {
    url = "mirror://alsa/plugins/${pname}-${version}.tar.bz2";
    sha256 = "0z9k3ssbfk2ky2w13avgyf202j1drsz9sv3834bp33cj1i2hc3qw";
  };

  nativeBuildInputs = [ pkg-config ];

  # ToDo: a52, etc.?
  buildInputs =
    [ alsaLib libogg ]
    ++ lib.optional (libpulseaudio != null) libpulseaudio
    # https://github.com/NixOS/nixpkgs/issues/96548
    ++ lib.optional (libjack2 != null && (stdenv.buildPlatform == stdenv.hostPlatform)) libjack2;

  meta = with lib; {
    description = "Various plugins for ALSA";
    homepage = "http://alsa-project.org/";
    license = licenses.lgpl21;
    maintainers = [ maintainers.marcweber ];
    platforms = platforms.linux;
  };
}

Revert "alsa-plugins: don't build with libjack2 support when cross-compiling"

{ stdenv, fetchurl, lib, pkg-config, alsaLib, libogg, libpulseaudio ? null, libjack2 ? null }:

stdenv.mkDerivation rec {
  pname = "alsa-plugins";
  version = "1.2.2";

  src = fetchurl {
    url = "mirror://alsa/plugins/${pname}-${version}.tar.bz2";
    sha256 = "0z9k3ssbfk2ky2w13avgyf202j1drsz9sv3834bp33cj1i2hc3qw";
  };

  nativeBuildInputs = [ pkg-config ];

  # ToDo: a52, etc.?
  buildInputs =
    [ alsaLib libogg ]
    ++ lib.optional (libpulseaudio != null) libpulseaudio
    ++ lib.optional (libjack2 != null) libjack2;

  meta = with lib; {
    description = "Various plugins for ALSA";
    homepage = "http://alsa-project.org/";
    license = licenses.lgpl21;
    maintainers = [ maintainers.marcweber ];
    platforms = platforms.linux;
  };
}


{ stdenv, squashfs-tools, perl, pathsFromGraph

, # The root directory of the squashfs filesystem is filled with the
  # closures of the Nix store paths listed here.
  storeContents ? []
}:

stdenv.mkDerivation {
  name = "squashfs.img";

  buildInputs = [perl squashfs-tools];

  # For obtaining the closure of `storeContents'.
  exportReferencesGraph =
    map (x: [("closure-" + baseNameOf x) x]) storeContents;

  buildCommand =
    ''
      # Add the closures of the top-level store objects.
      storePaths=$(perl ${pathsFromGraph} closure-*)

      # Also include a manifest of the closures in a format suitable
      # for nix-store --load-db.
      printRegistration=1 perl ${pathsFromGraph} closure-* > nix-path-registration

      # Generate the squashfs image.
      mksquashfs nix-path-registration $storePaths $out \
        -keep-as-directory -all-root
    '';
}

Make squashfs compress with xz

{ stdenv, squashfs-tools, perl, pathsFromGraph

, # The root directory of the squashfs filesystem is filled with the
  # closures of the Nix store paths listed here.
  storeContents ? []
}:

stdenv.mkDerivation {
  name = "squashfs.img";

  buildInputs = [
    perl
    squashfs-tools
  ];

  # For obtaining the closure of `storeContents'.
  exportReferencesGraph =
    map (x: [("closure-" + baseNameOf x) x]) storeContents;

  buildCommand = ''
    # Add the closures of the top-level store objects.
    storePaths=$(perl ${pathsFromGraph} closure-*)

    # Also include a manifest of the closures in a format suitable
    # for nix-store --load-db.
    printRegistration=1 perl ${pathsFromGraph} closure-* > nix-path-registration

    # Generate the squashfs image.
    mksquashfs nix-path-registration $storePaths $out \
      -keep-as-directory -all-root -comp xz
  '';
}


{ nixpkgs ?  import ./nixpkgs.nix {}
, ghc ? nixpkgs.haskell.compiler.ghc884 # Default needed for Docker build.
}:

with nixpkgs;

let
  openjdk = openjdk8;
  jvmlibdir =
    if stdenv.isLinux
    then "${openjdk}/lib/openjdk/jre/lib/amd64/server"
    else "${openjdk}/jre/lib/server";
in
haskell.lib.buildStackProject {
  name = "sparkle";
  buildInputs =
    [ git
      gradle
      ncurses5 # For intero
      openjdk
      spark
      which
      zlib
      zip
    ];
  inherit ghc;
  extraArgs = ["--extra-lib-dirs=${jvmlibdir}"];
  # XXX Workaround https://ghc.haskell.org/trac/ghc/ticket/11042.
  LD_LIBRARY_PATH = [jvmlibdir];
  # XXX By default recent Nixpkgs passes hardening flags to the
  # linker. The bindnow hardening flag is problematic, because it
  # makes objects fail to load in GHCi, with strange errors about
  # undefined symbols. See
  # https://ghc.haskell.org/trac/ghc/ticket/12684. As a workaround,
  # disable bindnow for now.
  hardeningDisable = [ "bindnow" ];
  LANG = "en_US.utf8";
}

Fix configuration of spark for stack builds.

{ nixpkgs ?  import ./nixpkgs.nix {}
, ghc ? nixpkgs.haskell.compiler.ghc884 # Default needed for Docker build.
}:

with nixpkgs;

let
  openjdk = openjdk8;
  jvmlibdir =
    if stdenv.isLinux
    then "${openjdk}/lib/openjdk/jre/lib/amd64/server"
    else "${openjdk}/jre/lib/server";
  # spark 2.4.4 is build with openjdk14 by default,
  # which causes the rddops example to fail.
  spark-jdk8 = spark.override { jre = openjdk; };
in
haskell.lib.buildStackProject {
  name = "sparkle";
  buildInputs =
    [ git
      gradle
      ncurses5 # For intero
      openjdk
      spark-jdk8
      which
      zlib
      zip
    ];
  inherit ghc;
  extraArgs = ["--extra-lib-dirs=${jvmlibdir}"];
  # XXX Workaround https://ghc.haskell.org/trac/ghc/ticket/11042.
  LD_LIBRARY_PATH = [jvmlibdir];
  # XXX By default recent Nixpkgs passes hardening flags to the
  # linker. The bindnow hardening flag is problematic, because it
  # makes objects fail to load in GHCi, with strange errors about
  # undefined symbols. See
  # https://ghc.haskell.org/trac/ghc/ticket/12684. As a workaround,
  # disable bindnow for now.
  hardeningDisable = [ "bindnow" ];
  LANG = "en_US.utf8";
}


{ stdenv, fetchurl, which, texLive }:

stdenv.mkDerivation {
  name = "EProver-1.2";

  src = fetchurl {
    name = "E-1.2.tar.gz";
    url = "http://www4.informatik.tu-muenchen.de/~schulz/WORK/E_DOWNLOAD/V_1.2/E.tgz";
    sha256 = "14sbpmh8vg376lrrq7i364aa8g5aacq344ihivxn6w4ydh9138nq";
  };

  buildInputs = [which texLive];

  preConfigure = "sed -e 's@^EXECPATH\\s.*@EXECPATH = '\$out'/bin@' -i Makefile.vars";

  buildPhase = "make install";

  # HOME=. allows to build missing TeX formats
  installPhase = ''
    mkdir -p $out/bin
    make install-exec
    HOME=. make documentation
    mkdir -p $out/share/doc
    cp -r DOC $out/share/doc/EProver
    echo eproof -xAuto --tstp-in --tstp-out '"$@"' > $out/bin/eproof-tptp
    chmod a+x $out/bin/eproof-tptp
  '';

  meta = {
    description = "E automated theorem prover";
    maintainers = [stdenv.lib.maintainers.raskin];
    platforms = stdenv.lib.platforms.all;
  };
}

Fix installation for updated E prover release

{ stdenv, fetchurl, which, texLive }:

stdenv.mkDerivation {
  name = "EProver-1.2";

  src = fetchurl {
    name = "E-1.2.tar.gz";
    url = "http://www4.informatik.tu-muenchen.de/~schulz/WORK/E_DOWNLOAD/V_1.2/E.tgz";
    sha256 = "14sbpmh8vg376lrrq7i364aa8g5aacq344ihivxn6w4ydh9138nq";
  };

  buildInputs = [which texLive];

  preConfigure = "sed -e 's@^EXECPATH\\s.*@EXECPATH = '\$out'/bin@' -i Makefile.vars";

  buildPhase = "make install";

  # HOME=. allows to build missing TeX formats
  installPhase = ''
    mkdir -p $out/bin
    make install
    HOME=. make documentation
    mkdir -p $out/share/doc
    cp -r DOC $out/share/doc/EProver
    echo eproof -xAuto --tstp-in --tstp-out '"$@"' > $out/bin/eproof-tptp
    chmod a+x $out/bin/eproof-tptp
  '';

  meta = {
    description = "E automated theorem prover";
    maintainers = [stdenv.lib.maintainers.raskin];
    platforms = stdenv.lib.platforms.all;
  };
}


{ stdenv, buildPythonPackage, fetchPypi, pytestrunner, pytest }:

buildPythonPackage rec {
  pname = "Cerberus";
  version = "1.3.1";

  src = fetchPypi {
    inherit pname version;
    sha256 = "0be48fc0dc84f83202a5309c0aa17cd5393e70731a1698a50d118b762fbe6875";
  };

  checkInputs = [ pytestrunner pytest ];

  meta = with stdenv.lib; {
    homepage = http://python-cerberus.org/;
    description = "Lightweight, extensible schema and data validation tool for Python dictionaries";
    license = licenses.mit;
  };
}

Revert "python: Cerberus: 1.1 -> 1.3.1"

{ stdenv, buildPythonPackage, fetchPypi, pytestrunner, pytest }:

buildPythonPackage rec {
  pname = "Cerberus";
  version = "1.1";

  src = fetchPypi {
    inherit pname version;
    sha256 = "1pxzr8sfm2hc5s96m9k044i44nwkva70n0ypr6a35v73zn891cx5";
  };

  checkInputs = [ pytestrunner pytest ];

  meta = with stdenv.lib; {
    homepage = http://python-cerberus.org/;
    description = "Lightweight, extensible schema and data validation tool for Python dictionaries";
    license = licenses.mit;
  };
}


{ stdenv, fetchurl, ed }:

stdenv.mkDerivation rec {
  name = "rcs-5.9.4";

  src = fetchurl {
    url = "mirror://gnu/rcs/${name}.tar.xz";
    sha256 = "1zsx7bb0rgvvvisiy4zlixf56ay8wbd9qqqcp1a1g0m1gl6mlg86";
  };

  buildInputs = [ ed ];

  doCheck = true;

  NIX_CFLAGS_COMPILE = if stdenv.isDarwin then "-std=gnu99" else null;

  meta = {
    homepage = http://www.gnu.org/software/rcs/;
    description = "Revision control system";
    longDescription =
      '' The GNU Revision Control System (RCS) manages multiple revisions of
         files. RCS automates the storing, retrieval, logging,
         identification, and merging of revisions.  RCS is useful for text
         that is revised frequently, including source code, programs,
         documentation, graphics, papers, and form letters.
      '';

    license = stdenv.lib.licenses.gpl3Plus;
    maintainers = with stdenv.lib.maintainers; [ eelco simons ];
    platforms = stdenv.lib.platforms.all;
  };
}

Fix build on gcc 5

{ stdenv, fetchurl, ed }:

stdenv.mkDerivation rec {
  name = "rcs-5.9.4";

  src = fetchurl {
    url = "mirror://gnu/rcs/${name}.tar.xz";
    sha256 = "1zsx7bb0rgvvvisiy4zlixf56ay8wbd9qqqcp1a1g0m1gl6mlg86";
  };

  buildInputs = [ ed ];

  doCheck = true;

  NIX_CFLAGS_COMPILE = [ "-std=c99" ];

  meta = {
    homepage = http://www.gnu.org/software/rcs/;
    description = "Revision control system";
    longDescription =
      '' The GNU Revision Control System (RCS) manages multiple revisions of
         files. RCS automates the storing, retrieval, logging,
         identification, and merging of revisions.  RCS is useful for text
         that is revised frequently, including source code, programs,
         documentation, graphics, papers, and form letters.
      '';

    license = stdenv.lib.licenses.gpl3Plus;
    maintainers = with stdenv.lib.maintainers; [ eelco simons ];
    platforms = stdenv.lib.platforms.all;
  };
}


{ lib, buildGoModule, fetchFromGitHub }:

buildGoModule {
  pname = "echoip";
  version = "unstable-2019-07-12";

  src = fetchFromGitHub {
    owner = "mpolden";
    repo = "echoip";
    rev = "fb5fac92d2173c2a5b07ed4ecc7b5fefe8484ed2";
    sha256 = "17gkh1qfxasvxy25lmjdwk5fsjkcp7lmw9si3xzf01m7qnj5zi4b";
  };

  modSha256 = "025p891klwpid5fw4z39fimgfkwgkcwqpn5276hflzdp1hfv35ly";

  postInstall = ''
    mkdir -p $out
    cp $src/index.html $out/index.html
  '';

  meta = with lib; {
    homepage = https://github.com/mpolden/echoip;
    license = licenses.bsd3;
    maintainers = with maintainers; [ rvolosatovs ];
  };
}

Use `index` output for index.html

{ lib, buildGoModule, fetchFromGitHub }:

buildGoModule {
  pname = "echoip";
  version = "unstable-2019-07-12";

  src = fetchFromGitHub {
    owner = "mpolden";
    repo = "echoip";
    rev = "fb5fac92d2173c2a5b07ed4ecc7b5fefe8484ed2";
    sha256 = "17gkh1qfxasvxy25lmjdwk5fsjkcp7lmw9si3xzf01m7qnj5zi4b";
  };

  modSha256 = "025p891klwpid5fw4z39fimgfkwgkcwqpn5276hflzdp1hfv35ly";

  outputs = [ "out" "index" ];

  postInstall = ''
    mkdir -p $index
    cp $src/index.html $index/index.html
  '';

  meta = with lib; {
    homepage = https://github.com/mpolden/echoip;
    license = licenses.bsd3;
    maintainers = with maintainers; [ rvolosatovs ];
  };
}


{ pkgs, ... }:
with pkgs; {
  imports = [ <nixpkgs/nixos/modules/installer/cd-dvd/installation-cd-graphical-gnome.nix> ];

  boot.kernelPackages = linuxPackages_latest;

  services.pcscd.enable = true;
  services.udev.packages = [ yubikey-personalization ];

  services.printing.enable = true;
  services.printing.drivers = [ pkgs.gutenprint ];

  environment.systemPackages = [
    gnupg
    keepassx
    libqrencode
    paperkey
    pinentry-curses
    wget
    yubikey-manager
    zbar
  ];

  programs = {
    ssh.startAgent = false;
    gnupg.agent = {
      enable = true;
      enableSSHSupport = true;
      pinentryFlavor = "curses";
    };
  };
}

Fix and name iso image for gpg environment OS

{ config, pkgs, ... }:
with pkgs; {
  imports = [ <nixpkgs/nixos/modules/installer/cd-dvd/installation-cd-graphical-gnome.nix> ];

  isoImage.isoBaseName = "nixos-gpg";
  boot.kernelPackages = linuxPackages_5_15;

  services.pcscd.enable = true;
  services.udev.packages = [ yubikey-personalization ];

  services.printing.enable = true;
  services.printing.drivers = [ pkgs.gutenprint ];

  environment.systemPackages = [
    gnupg
    keepassx
    libqrencode
    paperkey
    pinentry-curses
    wget
    yubikey-manager
    zbar
  ];

  programs = {
    ssh.startAgent = false;
    gnupg.agent = {
      enable = true;
      enableSSHSupport = true;
      pinentryFlavor = "curses";
    };
  };
}


{ stdenv, fetchurl, perl, flex, bison }:

stdenv.mkDerivation rec {
  name    = "verilator-${version}";
  version = "3.924";

  src = fetchurl {
    url    = "https://www.veripool.org/ftp/${name}.tgz";
    sha256 = "0xarifraycmdzjxs0lscpwvrwr59z84p8g8dkyjssc463dqikjvx";
  };

  enableParallelBuilding = true;
  buildInputs = [ perl flex bison ];

  postInstall = ''
    sed -i -e '3a\#!/usr/bin/env perl' -e '1,3d' $out/bin/{verilator,verilator_coverage,verilator_profcfunc}
  '';

  meta = {
    description = "Fast and robust (System)Verilog simulator/compiler";
    homepage    = "https://www.veripool.org/wiki/verilator";
    license     = stdenv.lib.licenses.lgpl3;
    platforms   = stdenv.lib.platforms.linux;
    maintainers = with stdenv.lib.maintainers; [ thoughtpolice ];
  };
}

Allow building on Darwin as well as Linux

{ stdenv, fetchurl, perl, flex, bison }:

stdenv.mkDerivation rec {
  name    = "verilator-${version}";
  version = "3.924";

  src = fetchurl {
    url    = "https://www.veripool.org/ftp/${name}.tgz";
    sha256 = "0xarifraycmdzjxs0lscpwvrwr59z84p8g8dkyjssc463dqikjvx";
  };

  enableParallelBuilding = true;
  buildInputs = [ perl flex bison ];

  postInstall = ''
    sed -i -e '3a\#!/usr/bin/env perl' -e '1,3d' $out/bin/{verilator,verilator_coverage,verilator_profcfunc}
  '';

  meta = {
    description = "Fast and robust (System)Verilog simulator/compiler";
    homepage    = "https://www.veripool.org/wiki/verilator";
    license     = stdenv.lib.licenses.lgpl3;
    platforms   = stdenv.lib.platforms.unix;
    maintainers = with stdenv.lib.maintainers; [ thoughtpolice ];
  };
}


{stdenv, fetchurl, gnutls, libtasn1, pkgconfig, readline, zlib, xz}:

stdenv.mkDerivation rec {
  name = "lftp-4.2.3";

  src = fetchurl {
    url = "ftp://ftp.cs.tu-berlin.de/pub/net/ftp/lftp/${name}.tar.xz";
    sha256 = "0l58lw2xgx9y64kz6mjd8ggdx92yr05rp08zssvsn8wx1vlvg6bh";
  };

  buildInputs = [gnutls libtasn1 pkgconfig readline zlib xz];
}

Advance lftp to version 4.3.1

{stdenv, fetchurl, gnutls, libtasn1, pkgconfig, readline, zlib, xz}:

stdenv.mkDerivation rec {
  name = "lftp-4.3.1";

  src = fetchurl {
    url = "ftp://ftp.cs.tu-berlin.de/pub/net/ftp/lftp/${name}.tar.xz";
    sha256 = "0v3591fknmimarzk5icm0qxdcfzfckwi2drh165vsiggmj590iyx";
  };

  buildInputs = [gnutls libtasn1 pkgconfig readline zlib xz];
}


{ stdenv, fetchurl, lib, cmake, qt4, qtscriptgenerator, perl, gettext, curl
, libxml2, mysql, taglib, taglib_extras, loudmouth , kdelibs, automoc4, phonon
, strigi, soprano, qca2, libmtp, liblastfm, libgpod }:

stdenv.mkDerivation rec {
  name = "${pname}-${version}";

  pname = "amarok";
  version = "2.3.2";

  src = fetchurl {
    url = "mirror://kde/stable/${pname}/${version}/src/${name}.tar.bz2";
    sha256 = "0dw2928vkd42h3d8nsb8i4xhp8qfj1zsfc1m9wrzrsxl0vd6j9c4";
  };

  QT_PLUGIN_PATH="${qtscriptgenerator}/lib/qt4/plugins";
  buildInputs = [ cmake qt4 qtscriptgenerator perl stdenv.gcc.libc gettext curl
    libxml2 mysql taglib taglib_extras loudmouth kdelibs automoc4 phonon strigi
    soprano qca2 libmtp liblastfm libgpod ];

  postInstall = ''
    mkdir -p $out/nix-support
    echo ${qtscriptgenerator} > $out/nix-support/propagated-user-env-packages
  '';
  meta = {
    description = "Popular music player for KDE";
    license = "GPL";
    homepage = http://amarok.kde.org;
    inherit (kdelibs.meta) platforms maintainers;
  };
}

Add pkgconfig to amarok buildInputs

{ stdenv, fetchurl, lib, cmake, qt4, qtscriptgenerator, perl, gettext, curl
, libxml2, mysql, taglib, taglib_extras, loudmouth , kdelibs, automoc4, phonon
, strigi, soprano, qca2, libmtp, liblastfm, libgpod, pkgconfig }:

stdenv.mkDerivation rec {
  name = "${pname}-${version}";

  pname = "amarok";
  version = "2.3.2";

  src = fetchurl {
    url = "mirror://kde/stable/${pname}/${version}/src/${name}.tar.bz2";
    sha256 = "0dw2928vkd42h3d8nsb8i4xhp8qfj1zsfc1m9wrzrsxl0vd6j9c4";
  };

  QT_PLUGIN_PATH="${qtscriptgenerator}/lib/qt4/plugins";
  buildInputs = [ cmake qt4 qtscriptgenerator perl stdenv.gcc.libc gettext curl
    libxml2 mysql taglib taglib_extras loudmouth kdelibs automoc4 phonon strigi
    soprano qca2 libmtp liblastfm libgpod pkgconfig ];

  postInstall = ''
    mkdir -p $out/nix-support
    echo ${qtscriptgenerator} > $out/nix-support/propagated-user-env-packages
  '';
  meta = {
    description = "Popular music player for KDE";
    license = "GPL";
    homepage = http://amarok.kde.org;
    inherit (kdelibs.meta) platforms maintainers;
  };
}


{ stdenv, python27Packages, fetchgit }:
let
  py = python27Packages;
  python = py.python;
in
py.buildPythonPackage rec {
  name = "loxodo-0.20150124";

  src = fetchgit {
    url = "https://github.com/sommer/loxodo.git";
    rev = "6c56efb4511fd6f645ad0f8eb3deafc8071c5795";
    sha256 = "02whmv4am8cz401rplplqzbipkyf0wd69z43sd3yw05rh7f3xbs2";
  };

  propagatedBuildInputs = with py; [ wxPython python.modules.readline ];

  postInstall = ''
    mv $out/bin/loxodo.py $out/bin/loxodo
  '';

  meta = with stdenv.lib; {
    description = "A Password Safe V3 compatible password vault";
    homepage = http://www.christoph-sommer.de/loxodo/;
    license = licenses.gpl2Plus;
    platforms = platforms.linux;
  };
}

Add a .desktop file for Loxodo

{ stdenv, python27Packages, fetchgit }:
let
  py = python27Packages;
  python = py.python;
in
py.buildPythonPackage rec {
  name = "loxodo-0.20150124";

  src = fetchgit {
    url = "https://github.com/sommer/loxodo.git";
    rev = "6c56efb4511fd6f645ad0f8eb3deafc8071c5795";
    sha256 = "02whmv4am8cz401rplplqzbipkyf0wd69z43sd3yw05rh7f3xbs2";
  };

  propagatedBuildInputs = with py; [ wxPython python.modules.readline ];

  postInstall = ''
    mv $out/bin/loxodo.py $out/bin/loxodo
    mkdir -p $out/share/applications
    cat > $out/share/applications/loxodo.desktop <<EOF
    [Desktop Entry]
    Type=Application
    Exec=$out/bin/loxodo
    Icon=$out/lib/${python.libPrefix}/site-packages/resources/loxodo-icon.png
    Name=Loxodo
    GenericName=Password Vault
    Categories=Application;Other;
    EOF
  '';

  meta = with stdenv.lib; {
    description = "A Password Safe V3 compatible password vault";
    homepage = http://www.christoph-sommer.de/loxodo/;
    license = licenses.gpl2Plus;
    platforms = platforms.linux;
  };
}


# Tools for Elixir coders

{ config, pkgs, ... }:

{
  services.postgresql.enable = true;

  environment.systemPackages = [
    pkgs.elixir
    pkgs.nodejs-5_x
    pkgs.inotify-tools
  ];
}

Add gcc and gnumake for building Phoenix app dependencies

# Tools for Elixir coders

{ config, pkgs, ... }:

{
  services.postgresql.enable = true;

  environment.systemPackages = [
    pkgs.elixir
    pkgs.nodejs-5_x
    pkgs.inotify-tools

    # To compile dependencies
    pkgs.gcc
    pkgs.gnumake
  ];
}


# emacs with init.el baked in

{ emacsWithPackages, epkgs, symlinkJoin, makeWrapper }:

let

  my-emacs = emacsWithPackages (epkgs: (with epkgs; [
    evil
    evil-org
    helm
    key-chord
    linum-relative
    magit
    markdown-mode
    org
    spaceline
    projectile
    color-theme-sanityinc-tomorrow
    which-key
  ]));

in
  symlinkJoin {
    name = "emacs";
    buildInputs = [ makeWrapper ];
    paths = [ my-emacs ];
    postBuild = ''
      wrapProgram "$out/bin/emacs" \
      --add-flags "-q -l ${./init.el}"
    '';
  }

Remove more unused emacs packages

# emacs with init.el baked in

{ emacsWithPackages, epkgs, symlinkJoin, makeWrapper }:

let

  my-emacs = emacsWithPackages (epkgs: (with epkgs; [
    evil
    evil-org
    helm
    key-chord
    linum-relative
    markdown-mode
    org
    spaceline
    color-theme-sanityinc-tomorrow
    which-key
  ]));

in
  symlinkJoin {
    name = "emacs";
    buildInputs = [ makeWrapper ];
    paths = [ my-emacs ];
    postBuild = ''
      wrapProgram "$out/bin/emacs" \
      --add-flags "-q -l ${./init.el}"
    '';
  }


{
  mkDerivation, lib,
  extra-cmake-modules, docbook_xml_dtd_45, docbook5_xsl,
  karchive, ki18n, qtbase,
  perl, perlPackages
}:

mkDerivation {
  name = "kdoctools";
  meta = { maintainers = [ lib.maintainers.ttuegel ]; };
  nativeBuildInputs = [ extra-cmake-modules ];
  propagatedNativeBuildInputs = [ perl perlPackages.URI ];
  buildInputs = [ karchive ki18n ];
  propagatedBuildInputs = [ qtbase ];
  outputs = [ "out" "dev" ];
  patches = [ ./kdoctools-no-find-docbook-xml.patch ];
  preConfigure = ''
    outputBin=dev
  '';
  cmakeFlags = [
    "-DDocBookXML4_DTD_DIR=${docbook_xml_dtd_45}/xml/dtd/docbook"
    "-DDocBookXSL_DIR=${docbook5_xsl}/xml/xsl/docbook"
  ];
  postFixup = ''
    moveToOutput "share/doc" "$dev"
    moveToOutput "share/man" "$dev"
  '';
}

Move bin stuff to the "out" output

{
  mkDerivation, lib,
  extra-cmake-modules, docbook_xml_dtd_45, docbook5_xsl,
  karchive, ki18n, qtbase,
  perl, perlPackages
}:

mkDerivation {
  name = "kdoctools";
  meta = { maintainers = [ lib.maintainers.ttuegel ]; };
  nativeBuildInputs = [ extra-cmake-modules ];
  propagatedNativeBuildInputs = [ perl perlPackages.URI ];
  buildInputs = [ karchive ki18n ];
  propagatedBuildInputs = [ qtbase ];
  outputs = [ "out" "dev" ];
  patches = [ ./kdoctools-no-find-docbook-xml.patch ];
  cmakeFlags = [
    "-DDocBookXML4_DTD_DIR=${docbook_xml_dtd_45}/xml/dtd/docbook"
    "-DDocBookXSL_DIR=${docbook5_xsl}/xml/xsl/docbook"
  ];
  postFixup = ''
    moveToOutput "share/doc" "$dev"
    moveToOutput "share/man" "$dev"
  '';
}


{ stdenv, fetchFromGitHub, kernel, libdrm }:

stdenv.mkDerivation rec {
  name = "evdi-${version}";
  version = "1.4.1+git2017-06-12";

  src = fetchFromGitHub {
    owner = "DisplayLink";
    repo = "evdi";
    rev = "ee1c578774e62fe4b08d92750620ed3094642160";
    sha256 = "1m3wkmw4hjpjax7rvhmpicz09d7vxcxklq797ddjg6ljvf12671b";
  };

  buildInputs = [ kernel libdrm ];

  makeFlags = [ "KVER=${kernel.modDirVersion}" "KDIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build" ];

  hardeningDisable = [ "pic" "format" ];

  installPhase = ''
    install -Dm755 module/evdi.ko $out/lib/modules/${kernel.modDirVersion}/kernel/drivers/gpu/drm/evdi/evdi.ko
    install -Dm755 library/libevdi.so $out/lib/libevdi.so
  '';

  meta = with stdenv.lib; {
    description = "Extensible Virtual Display Interface";
    platforms = platforms.linux;
    license = licenses.gpl2;
    homepage = http://www.displaylink.com/;
    broken = versionOlder kernel.version "4.9";
  };
}

Mark broken on >= 4.13

{ stdenv, fetchFromGitHub, kernel, libdrm }:

stdenv.mkDerivation rec {
  name = "evdi-${version}";
  version = "1.4.1+git2017-06-12";

  src = fetchFromGitHub {
    owner = "DisplayLink";
    repo = "evdi";
    rev = "ee1c578774e62fe4b08d92750620ed3094642160";
    sha256 = "1m3wkmw4hjpjax7rvhmpicz09d7vxcxklq797ddjg6ljvf12671b";
  };

  buildInputs = [ kernel libdrm ];

  makeFlags = [ "KVER=${kernel.modDirVersion}" "KDIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build" ];

  hardeningDisable = [ "pic" "format" ];

  installPhase = ''
    install -Dm755 module/evdi.ko $out/lib/modules/${kernel.modDirVersion}/kernel/drivers/gpu/drm/evdi/evdi.ko
    install -Dm755 library/libevdi.so $out/lib/libevdi.so
  '';

  meta = with stdenv.lib; {
    description = "Extensible Virtual Display Interface";
    platforms = platforms.linux;
    license = licenses.gpl2;
    homepage = http://www.displaylink.com/;
    broken = versionOlder kernel.version "4.9" || !stdenv.lib.versionOlder kernel.version "4.13";
  };
}


{ stdenv, fetchurl, alsaLib }:

stdenv.mkDerivation rec {
  name = "lirc-0.9.0";

  src = fetchurl {
    url = "mirror://sourceforge/lirc/${name}.tar.bz2";
    sha256 = "1zx4mcnjwzz6jsi6ln7a3dkgx05nvg1pxxvmjqvd966ldapay8v3";
  };

  buildInputs = [ alsaLib ];

  configureFlags = "--with-driver=none --enable-sandboxed";
}

Build devinput driver, which doesn't require any special modules

{ stdenv, fetchurl, alsaLib }:

stdenv.mkDerivation rec {
  name = "lirc-0.9.0";

  src = fetchurl {
    url = "mirror://sourceforge/lirc/${name}.tar.bz2";
    sha256 = "1zx4mcnjwzz6jsi6ln7a3dkgx05nvg1pxxvmjqvd966ldapay8v3";
  };

  buildInputs = [ alsaLib ];

  configureFlags = [
    "--with-driver=devinput"
    "--sysconfdir=$(out)/etc"
    "--enable-sandboxed"
  ];
}


{ lib
, buildPythonPackage
, fetchPypi
, mock
, scripttest
, virtualenv
, pretend
, pytest
}:

buildPythonPackage rec {
  pname = "pip";
  version = "19.1.1";

  src = fetchPypi {
    inherit pname version;
    sha256 = "0n09vnyn8q3vf31prb050s2nfx4gvwy1gwazgrfbc7hasg9xgls4";
  };

  # pip detects that we already have bootstrapped_pip "installed", so we need
  # to force it a little.
  installFlags = [ "--ignore-installed" ];

  checkInputs = [ mock scripttest virtualenv pretend pytest ];
  # Pip wants pytest, but tests are not distributed
  doCheck = false;

  meta = {
    description = "The PyPA recommended tool for installing Python packages";
    license = lib.licenses.mit;
    homepage = https://pip.pypa.io/;
    priority = 10;
  };
}

Revert "python.pkgs.pip: 19.0.3 -> 19.1.1"

{ lib
, buildPythonPackage
, fetchPypi
, mock
, scripttest
, virtualenv
, pretend
, pytest
}:

buildPythonPackage rec {
  pname = "pip";
  version = "19.0.3";

  src = fetchPypi {
    inherit pname version;
    sha256 = "6e6f197a1abfb45118dbb878b5c859a0edbdd33fd250100bc015b67fded4b9f2";
  };

  # pip detects that we already have bootstrapped_pip "installed", so we need
  # to force it a little.
  installFlags = [ "--ignore-installed" ];

  checkInputs = [ mock scripttest virtualenv pretend pytest ];
  # Pip wants pytest, but tests are not distributed
  doCheck = false;

  meta = {
    description = "The PyPA recommended tool for installing Python packages";
    license = lib.licenses.mit;
    homepage = https://pip.pypa.io/;
    priority = 10;
  };
}


# This module contains the basic configuration for building a graphical NixOS
# installation CD.

{ config, lib, pkgs, ... }:

with lib;

{
  imports = [ ./installation-cd-base.nix ];

  services.xserver = {
    enable = true;

    # Don't start the X server by default.
    autorun = mkForce false;

    # Automatically login as root.
    displayManager.slim = {
      enable = true;
      defaultUser = "root";
      autoLogin = true;
    };

  };

  # Provide networkmanager for easy wireless configuration.
  networking.networkmanager.enable = true;
  networking.wireless.enable = mkForce false;

  # KDE complains if power management is disabled (to be precise, if
  # there is no power management backend such as upower).
  powerManagement.enable = true;

  environment.systemPackages = [
    # Include gparted for partitioning disks.
    pkgs.gparted

    # Include some editors.
    pkgs.vim
    pkgs.bvi # binary editor
    pkgs.joe

    # Firefox for reading the manual.
    pkgs.firefox

    pkgs.glxinfo
  ];

}

Enable pulseaudio in all graphical iso's

# This module contains the basic configuration for building a graphical NixOS
# installation CD.

{ config, lib, pkgs, ... }:

with lib;

{
  imports = [ ./installation-cd-base.nix ];

  services.xserver = {
    enable = true;

    # Don't start the X server by default.
    autorun = mkForce false;

    # Automatically login as root.
    displayManager.slim = {
      enable = true;
      defaultUser = "root";
      autoLogin = true;
    };

  };

  # Provide networkmanager for easy wireless configuration.
  networking.networkmanager.enable = true;
  networking.wireless.enable = mkForce false;

  # KDE complains if power management is disabled (to be precise, if
  # there is no power management backend such as upower).
  powerManagement.enable = true;

  # Enable sound in graphical iso's.
  hardware.pulseaudio.enable = true;
  hardware.pulseaudio.systemWide = true; # Needed since we run plasma as root.

  environment.systemPackages = [
    # Include gparted for partitioning disks.
    pkgs.gparted

    # Include some editors.
    pkgs.vim
    pkgs.bvi # binary editor
    pkgs.joe

    # Firefox for reading the manual.
    pkgs.firefox

    pkgs.glxinfo
  ];

}


{ stdenv, appleDerivation, dyld, osx_private_sdk }:

appleDerivation {
  buildPhase = ":";

  # install headers only
  installPhase = ''
    mkdir -p $out/lib
    make install-data-am
  '';

  meta = with stdenv.lib; {
    maintainers = with maintainers; [ copumpkin lnl7 ];
    platforms   = platforms.darwin;
    license     = licenses.apsl20;
  };
}

Revert "darwin.libunwind: fix install phase"

{ stdenv, appleDerivation, dyld, osx_private_sdk }:

appleDerivation {
  phases = [ "unpackPhase" "installPhase" ];

  installPhase = ''
    mkdir -p $out/lib
    cp -R include $out/include
  '';

  meta = with stdenv.lib; {
    maintainers = with maintainers; [ copumpkin ];
    platforms   = platforms.darwin;
    license     = licenses.apsl20;
  };
}


{ config, pkgs, ... }:

{
  nixpkgs.config.allowUnfree = true;

  nixpkgs.overlays = [ (import ./overlay) ];

  nix.useSandbox = true;

  system.autoUpgrade = {
    enable = true;
    channel = https://nixos.org/channels/nixos-unstable;
    dates = "0/1:00:00"; # means "every hour on the hour"
  };

  # run nix-collect-garbage automatically
  nix.gc = {
    automatic = true;
    dates = "0/1:00:00"; # means "every hour on the hour"
  };

  programs.command-not-found.enable = true;
}

Remove command-not-found handling, add system.stateVersion

{ config, pkgs, ... }:

{
  nixpkgs.config.allowUnfree = true;

  nixpkgs.overlays = [ (import ./overlay) ];

  nix.useSandbox = true;

  system.autoUpgrade = {
    enable = true;
    channel = https://nixos.org/channels/nixos-unstable;
    dates = "0/1:00:00"; # means "every hour on the hour"
  };

  # run nix-collect-garbage automatically
  nix.gc = {
    automatic = true;
    dates = "0/1:00:00"; # means "every hour on the hour"
  };

  system.stateVersion = "unstable";
}


{ stdenv, lib, buildGoPackage, fetchgit, fetchhg, fetchbzr, fetchsvn }:

buildGoPackage rec {
  name = "hologram-${version}";
  version = "20170130-${stdenv.lib.strings.substring 0 7 rev}";
  rev = "d20d1c30379e7010e8f9c428a5b9e82f54d390e1";

  src = fetchgit {
    inherit rev;
    url = "https://github.com/AdRoll/hologram";
    sha256 = "0dg5kfs16kf2gzhpmzsg83qzi2pxgnc9g81lw5zpa6fmzpa9kgsn";
  };

  goPackagePath = "github.com/AdRoll/hologram";

  goDeps = ./deps.nix;

  meta = with stdenv.lib; {
    homepage = https://github.com/AdRoll/hologram/;
    description = "Easy, painless AWS credentials on developer laptops.";
    maintainers = with maintainers; [ nand0p ];
    platforms = platforms.all;
    license = licenses.asl20;
  };
}

Fix hologram server with go versions > 1.4, no fix yet upstream.

{ stdenv, lib, buildGoPackage, fetchgit, fetchhg, fetchbzr, fetchsvn }:

buildGoPackage rec {
  name = "hologram-${version}";
  version = "20170130-${stdenv.lib.strings.substring 0 7 rev}";
  rev = "d20d1c30379e7010e8f9c428a5b9e82f54d390e1";

  src = fetchgit {
    inherit rev;
    url = "https://github.com/AdRoll/hologram";
    sha256 = "0dg5kfs16kf2gzhpmzsg83qzi2pxgnc9g81lw5zpa6fmzpa9kgsn";
  };

  goPackagePath = "github.com/AdRoll/hologram";

  goDeps = ./deps.nix;

  preConfigure = ''
    sed -i 's|cacheTimeout != 3600|cacheTimeout != 0|' cmd/hologram-server/main.go
  '';

  meta = with stdenv.lib; {
    homepage = https://github.com/AdRoll/hologram/;
    description = "Easy, painless AWS credentials on developer laptops.";
    maintainers = with maintainers; [ nand0p ];
    platforms = platforms.all;
    license = licenses.asl20;
  };
}