# This file is autogenerated from update.sh in the same directory.
{
  beta = {
    sha256 = "16m7q5xfbzf1j9figilis56m1ls68v0i4zm9vp0rg64n8xny2qhw";
    sha256bin64 = "0wzzmsyp0qvbvbb8g1gjzc572c1gnn442kx3rkvcmdfakjamq93s";
    version = "59.0.3071.36";
  };
  dev = {
    sha256 = "07zw8a4af0f1cqlbgm5v2rbj0bzkc02im8s8ylfhya51lgwa0ypl";
    sha256bin64 = "1djamdiywfg4fjll6nbk3fdhd5dc5h1mq5d56m1avf1yx4vyk807";
    version = "60.0.3088.3";
  };
  stable = {
    sha256 = "10ai9bzw6b5p6ak2fd90pg8jlk79ahiz21gzm2fx12xmsdxgsf2x";
    sha256bin64 = "06k6h93jff9slrmhl3bblq3kskxdp1357jqrzajg2zl23ja47f8m";
    version = "58.0.3029.96";
  };
}

Revert "google-chrome: 57.0.2987.133 -> 58.0.3029.96"

# This file is autogenerated from update.sh in the same directory.
{
  beta = {
    sha256 = "1q9iqmq5amzfw03jiw18g1w285b6x2qckn8gc60r5m3xx1hbivv2";
    sha256bin64 = "1ddhhcydcwwc2pkwm4c8rlr60968zy5vda410g4bwx0v5q7p22q9";
    version = "58.0.3029.68";
  };
  dev = {
    sha256 = "0zvnj9n2p057fxx7n4d1qc0nw34qhlsvrx20fwigq96blamckvd8";
    sha256bin64 = "1s1r3h7x49bp64lzzphm4jcg7g68l0x7mr3airj3hqii58dvndm0";
    version = "59.0.3067.0";
  };
  stable = {
    sha256 = "1xwchazqqx0cs9rd15r80kw6p918zp9libx34qlcj8p5lxq1f0bh";
    sha256bin64 = "0ggn5rljch36sx0i37qzp6ldcy3ibdj0z9217lqzjq3r7ixsfqja";
    version = "57.0.2987.133";
  };
}


{ cabal, fetchgit, ghcjsBase, mtl }:

cabal.mkDerivation (self: {
  pname = "ghcjs-dom";
  version = "0.1.0.0";
  src = fetchgit {
    url = git://github.com/ghcjs/ghcjs-dom.git;
    rev = "81805e75ccd41501774b90c04efd9e00d52e9798";
    sha256 = "3aa56fb81974533661aa056ed080edab29bef8ab26dae61999de4452f95949f6";
  };

  buildDepends = [ ghcjsBase mtl ];
  meta = {
    description = "DOM library that supports both GHCJS and WebKitGTK";
    license = self.stdenv.lib.licenses.mit;
    platforms = self.ghc.meta.platforms;
  };
})

Add support for webkit builds to haskellPackages.ghcjsDom

{ cabal, fetchgit, ghc, mtl
, buildType ? if (builtins.parseDrvName ghc.ghc.name).name == "ghcjs" then "jsffi" else "webkit"
, ghcjsBase ? null # jsffi dependencies
, glib ? null, transformers ? null, gtk ? null, webkit ? null # webkit dependencies
}:

cabal.mkDerivation (self: {
  pname = "ghcjs-dom";
  version = "0.1.0.0";
  src = fetchgit {
    url = https://github.com/ghcjs/ghcjs-dom;
    rev = "81805e75ccd41501774b90c04efd9e00d52e9798";
    sha256 = "3aa56fb81974533661aa056ed080edab29bef8ab26dae61999de4452f95949f6";
  };
  buildDepends = [ mtl ] ++ (if buildType == "jsffi" then [ ghcjsBase ] else if buildType == "webkit" then [ glib transformers gtk webkit ] else throw "unrecognized buildType");
  configureFlags = if buildType == "jsffi" then [ ] else if buildType == "webkit" then [ "-f-ghcjs" "-fwebkit" "-f-gtk3" ] else throw "unrecognized buildType";
  meta = {
    description = "DOM library that supports both GHCJS and WebKitGTK";
    license = self.stdenv.lib.licenses.mit;
    platforms = self.ghc.meta.platforms;
  };
})


{ stdenv, fetchurl, pkgconfig, glib, bison, flex }:

stdenv.mkDerivation rec {
  name = "gob2-2.0.18";

  src = fetchurl {
    url = "http://ftp.5z.com/pub/gob/${name}.tar.gz";
    sha256 = "1r242s3rsxyqiw2ic2gdpvvrx903jgjd1aa4mkl26in5k9zk76fa";
  };

  # configure script looks for d-bus but it is only needed for tests
  buildInputs = [ glib bison flex pkgconfig ];

  meta = {
    description = "Preprocessor for making GObjects with inline C code";
    homepage = http://www.jirka.org/gob.html;
    license = "GPLv2+";
  };
}

Use fetchurl_gnome. Previous URL disappeared.

{ stdenv, fetchurl_gnome, pkgconfig, glib, bison, flex }:

stdenv.mkDerivation rec {
  name = src.pkgname;

  src = fetchurl_gnome {
    project = "gob2";
    major = "2"; minor = "0"; patchlevel = "18"; extension = "gz";
    sha256 = "1r242s3rsxyqiw2ic2gdpvvrx903jgjd1aa4mkl26in5k9zk76fa";
  };

  # configure script looks for d-bus but it is only needed for tests
  buildInputs = [ glib bison flex pkgconfig ];

  meta = {
    description = "Preprocessor for making GObjects with inline C code";
    homepage = http://www.jirka.org/gob.html;
    license = "GPLv2+";
  };
}


{ cabal, mtl, QuickCheck, testFramework, testFrameworkQuickcheck2
, transformers
}:

cabal.mkDerivation (self: {
  pname = "exceptions";
  version = "0.3.2";
  sha256 = "0c1d78wm8is9kyv26drbx3f1sq2bfcq5m6wfw2qzwgalb3z2kxlw";
  buildDepends = [ mtl transformers ];
  testDepends = [
    mtl QuickCheck testFramework testFrameworkQuickcheck2 transformers
  ];
  doCheck = false;
  meta = {
    homepage = "http://github.com/ekmett/exceptions/";
    description = "Extensible optionally-pure exceptions";
    license = "unknown";
    platforms = self.ghc.meta.platforms;
    maintainers = [ self.stdenv.lib.maintainers.ocharles ];
  };
})

Update to 0.3.3 and enable tests

{ cabal, mtl, QuickCheck, testFramework, testFrameworkQuickcheck2
, transformers
}:

cabal.mkDerivation (self: {
  pname = "exceptions";
  version = "0.3.3";
  sha256 = "1gng8zvsljm6xrb5gy501f1dl47z171wkic8bsivhn4rgp9lby9l";
  buildDepends = [ mtl transformers ];
  testDepends = [
    mtl QuickCheck testFramework testFrameworkQuickcheck2 transformers
  ];
  meta = {
    homepage = "http://github.com/ekmett/exceptions/";
    description = "Extensible optionally-pure exceptions";
    license = "unknown";
    platforms = self.ghc.meta.platforms;
    maintainers = [ self.stdenv.lib.maintainers.ocharles ];
  };
})


# The workstation role configures a machine with settings and command line tools
# expected to be on a workstation meant to get things done!

{ config, pkgs, ... }:

let
  neopkgs = import ../mypkgs/neopkgs.nix { };
in
{
  users.extraUsers.kiba = {
    description = "Kiba Fox";
    isNormalUser = true;
    extraGroups = [
      "wheel"
    ];
    uid = 1000;
  };

  i18n = {
    consoleFont = "Lat2-Terminus16";
    consoleKeyMap = "us";
    defaultLocale = "en_US.UTF-8";
  };

  environment.variables = {
    EDITOR = "nvim";
  };

  environment.systemPackages = [
    neopkgs.fish
    neopkgs.neovim        # Neovim, my editor of choice
    pkgs.bash
    pkgs.curl
    pkgs.dos2unix         # Convert between dos and unix line endings
    pkgs.git              # Source control
    pkgs.htop
    pkgs.isync            # Email sync, an alternative to OfflineIMAP
    pkgs.lynx
    pkgs.mosh             # The mobile shell
    pkgs.pngnq            # Lossy PNG compressor
    pkgs.psmisc           # includes killall
    pkgs.pwgen            # Password generator
    pkgs.python
    pkgs.silver-searcher
    pkgs.tmux
    pkgs.wget
    pkgs.which            # Some programs depend on this
  ];
}

Add python3 and ctags for neovim plugins

# The workstation role configures a machine with settings and command line tools
# expected to be on a workstation meant to get things done!

{ config, pkgs, ... }:

let
  neopkgs = import ../mypkgs/neopkgs.nix { };
in
{
  users.extraUsers.kiba = {
    description = "Kiba Fox";
    isNormalUser = true;
    extraGroups = [
      "wheel"
    ];
    uid = 1000;
  };

  i18n = {
    consoleFont = "Lat2-Terminus16";
    consoleKeyMap = "us";
    defaultLocale = "en_US.UTF-8";
  };

  environment.variables = {
    EDITOR = "nvim";
  };

  environment.systemPackages = [
    neopkgs.fish
    neopkgs.neovim        # Neovim, my editor of choice
    pkgs.bash
    pkgs.ctags
    pkgs.curl
    pkgs.dos2unix         # Convert between dos and unix line endings
    pkgs.git              # Source control
    pkgs.htop
    pkgs.isync            # Email sync, an alternative to OfflineIMAP
    pkgs.lynx
    pkgs.mosh             # The mobile shell
    pkgs.pngnq            # Lossy PNG compressor
    pkgs.psmisc           # includes killall
    pkgs.pwgen            # Password generator
    pkgs.python
    pkgs.python3
    pkgs.silver-searcher
    pkgs.tmux
    pkgs.wget
    pkgs.which            # Some programs depend on this
  ];
}


{stdenv, fetchurl, openssl, libidn, glib, pkgconfig, zlib}:

stdenv.mkDerivation {
  name = "loudmouth-1.4.3";

  src = fetchurl {
    url = mirror://gnome/sources/loudmouth/1.4/loudmouth-1.4.3.tar.bz2;
    md5 = "55339ca42494690c3942ee1465a96937";
  };

  configureFlags = "--with-ssl=openssl";

  propagatedBuildInputs = [openssl libidn glib zlib];

  buildInputs = [pkgconfig];
}

Fix building with the latest glib

{ stdenv, fetchurl, openssl, libidn, glib, pkgconfig, zlib }:

stdenv.mkDerivation rec {
  name = "loudmouth-1.4.3";

  src = fetchurl {
    url = "mirror://gnome/sources/loudmouth/1.4/${name}.tar.bz2";
    md5 = "55339ca42494690c3942ee1465a96937";
  };

  patches = [ ./glib-2.32.patch ];

  configureFlags = "--with-ssl=openssl";

  propagatedBuildInputs = [ openssl libidn glib zlib ];

  buildInputs = [ pkgconfig ];

  meta = {
    description = "A lightweight C library for the Jabber protocol";
  };
}


{ stdenv
, buildPythonPackage
, fetchPyPi
, lib

, cheroot
, jaraco-classes
, portend
, setuptools-scm
, six
}:

let
  version = "18.1.0";
in
buildPythonPackage rec {
  name = "cherrypy-${version}";

  src = fetchPyPi {
    package = "CherryPy";
    inherit version;
    sha256 = "4dd2f59b5af93bd9ca85f1ed0bb8295cd0f5a8ee2b84d476374d4e070aa5c615";
  };

  propagatedBuildInputs = [
    cheroot
    jaraco-classes
    portend
    setuptools-scm
    six
  ];

  doCheck = false;

  meta = with lib; {
    description = "A pythonic, object-oriented HTTP framework";
    homepage = http://www.cherrypy.org;
    license = licenses.bsd3;
    maintainers = with maintainers; [
      codyopel
    ];
    platforms = with platforms;
      x86_64-linux;
  };
}

Revert "cherrypy: 17.0.0 -> 18.1.0"

{ stdenv
, buildPythonPackage
, fetchPyPi
, lib

, cheroot
, jaraco-classes
, portend
, setuptools-scm
, six
}:

let
  version = "17.0.0";
in
buildPythonPackage rec {
  name = "cherrypy-${version}";

  src = fetchPyPi {
    package = "CherryPy";
    inherit version;
    sha256 = "3cdb5fbae183db49ab1f1a90643d521aa060c93f90001cc99c19d8d15b7a3fb7";
  };

  propagatedBuildInputs = [
    cheroot
    jaraco-classes
    portend
    setuptools-scm
    six
  ];

  doCheck = false;

  meta = with lib; {
    description = "A pythonic, object-oriented HTTP framework";
    homepage = http://www.cherrypy.org;
    license = licenses.bsd3;
    maintainers = with maintainers; [
      codyopel
    ];
    platforms = with platforms;
      x86_64-linux;
  };
}


{ stdenv, fetchsvn, cups, zlib, jbigkit }:

let rev = "315"; in
stdenv.mkDerivation rec {
  name = "splix-svn-${rev}";

  src = fetchsvn {
    # We build this from svn, because splix hasn't been in released in several years
    # although the community has been adding some new printer models.
    url = "svn://svn.code.sf.net/p/splix/code/splix";
    rev = "r${rev}";
    sha256 = "16wbm4xnz35ca3mw2iggf5f4jaxpyna718ia190ka6y4ah932jxl";
  };

  preBuild = ''
    makeFlags="$makeFlags CUPSFILTER=$out/lib/cups/filter CUPSDRV=$out/share/cups/drv"
  '';

  buildFlags = [ "drv" "all" ];

  makeFlags = [ "DRV_ONLY=1" ];

  buildInputs = [ cups zlib jbigkit ];

  meta = {
    description = "CUPS drivers for SPL (Samsung Printer Language) printers";
    homepage = http://splix.sourceforge.net;
    platforms = stdenv.lib.platforms.linux;
    maintainers = [ stdenv.lib.maintainers.peti ];
  };
}

Revert "splix: move to DRVs over PPDs"

{ stdenv, fetchsvn, fetchurl, cups, zlib }:
let rev = "315"; in
stdenv.mkDerivation rec {
  name = "splix-svn-${rev}";
  src = fetchsvn {
    # We build this from svn, because splix hasn't been in released in several years
    # although the community has been adding some new printer models.
    url = "svn://svn.code.sf.net/p/splix/code/splix";
    rev = "r${rev}";
    sha256 = "16wbm4xnz35ca3mw2iggf5f4jaxpyna718ia190ka6y4ah932jxl";
  };

  preBuild = ''
    makeFlags="V=1 DISABLE_JBIG=1 CUPSFILTER=$out/lib/cups/filter CUPSPPD=$out/share/cups/model"
  '';

  buildInputs = [cups zlib];

  meta = {
    homepage = http://splix.sourceforge.net;
    platforms = stdenv.lib.platforms.linux;
    maintainers = [ stdenv.lib.maintainers.peti ];
  };
}


{ localLib ? import ./../../../lib.nix
, pkgs ? (import (localLib.fetchNixPkgs) { inherit system config; })
, system ? builtins.currentSystem
, config ? {}
, gitrev ? "123456"
}:

with localLib;

let
  iohkPkgs = import ./../../.. { inherit config system pkgs gitrev; };
  gen-swagger-file = "${iohkPkgs.cardano-sl-tools}/bin/cardano-swagger-file";
  validate-json = "${iohkPkgs.validateJson}";
  schema = ./../../../tools/src/validate-json/swagger-meta-2.0.json;
in pkgs.writeScript "validate-swagger-schema" ''
  ${generate-swagger-file} --target wallet@v0 --output-file swagger.v0.json
  ${validate-json} --schema ${schema} swagger.v0.json
  ${generate-swagger-file} --target wallet@v1 --output-file swagger.v1.json
  ${validate-json} --schema ${schema} swagger.v1.json
  rm swagger.*.json
''

Make sure to exit with proper status when validating swagger

{ localLib ? import ./../../../lib.nix
, pkgs ? (import (localLib.fetchNixPkgs) { inherit system config; })
, system ? builtins.currentSystem
, config ? {}
, gitrev ? "123456"
}:

with localLib;

let
  iohkPkgs = import ./../../.. { inherit config system pkgs gitrev; };
  gen-swagger-file = "${iohkPkgs.cardano-sl-tools}/bin/cardano-swagger-file";
  validate-json = "${iohkPkgs.validateJson}";
  schema = ./../../../tools/src/validate-json/swagger-meta-2.0.json;
in pkgs.writeScript "validate-swagger-schema" ''
  ${generate-swagger-file} --target wallet@v0 --output-file swagger.v0.json
  ${generate-swagger-file} --target wallet@v1 --output-file swagger.v1.json
  ${validate-json} --schema ${schema} swagger.v0.json && ${validate-json} --schema ${schema} swagger.v1.json
  EXIT_STATUS=$?
  rm -f swagger.*.json
  exit $EXIT_STATUS
''


a :
let
  fetchurl = a.fetchurl;

  version = a.lib.attrByPath ["version"] "v3-5" a;
  buildInputs = with a; [
    sbcl
  ];
in
rec {
  src = fetchurl {
    url = "http://www.cs.utexas.edu/users/moore/acl2/${version}/distrib/acl2.tar.gz";
    sha256 = "0zmh1njpp7n7azcyjlygr0h0k51d18s1jkj0dr1jn2bh7mpysajk";
    name = "acl2-${version}.tar.gz";
  };

  inherit buildInputs;
  configureFlags = [];

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

  makeFlags = ["LISP='${a.sbcl}/bin/sbcl'"];

  installSuffix = "acl2";
  doDeploy = (a.simplyShare installSuffix);
  doBuild = a.fullDepEntry (''
    cd $out/share/${installSuffix}
    make LISP=${a.sbcl}/bin/sbcl
    make LISP=${a.sbcl}/bin/sbcl regression
    ensureDir "$out/bin"
    cp saved_acl2 "$out/bin/acl2"
  '') ["doDeploy" "addInputs" "defEnsureDir"];

  name = "acl2-" + version;
  meta = {
    description = "An interpreter and a prover for a Lisp dialect";
    maintainers = [
    ];
  };
}

Add myself as a maintainer

a :
let
  fetchurl = a.fetchurl;

  version = a.lib.attrByPath ["version"] "v3-5" a;
  buildInputs = with a; [
    sbcl
  ];
in
rec {
  src = fetchurl {
    url = "http://www.cs.utexas.edu/users/moore/acl2/${version}/distrib/acl2.tar.gz";
    sha256 = "0zmh1njpp7n7azcyjlygr0h0k51d18s1jkj0dr1jn2bh7mpysajk";
    name = "acl2-${version}.tar.gz";
  };

  inherit buildInputs;
  configureFlags = [];

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

  makeFlags = ["LISP='${a.sbcl}/bin/sbcl'"];

  installSuffix = "acl2";
  doDeploy = (a.simplyShare installSuffix);
  doBuild = a.fullDepEntry (''
    cd $out/share/${installSuffix}
    make LISP=${a.sbcl}/bin/sbcl
    make LISP=${a.sbcl}/bin/sbcl regression
    ensureDir "$out/bin"
    cp saved_acl2 "$out/bin/acl2"
  '') ["doDeploy" "addInputs" "defEnsureDir"];

  name = "acl2-" + version;
  meta = {
    description = "An interpreter and a prover for a Lisp dialect";
    maintainers = with a.lib.maintainers;
    [
      raskin
    ];
    platforms = with a.lib.platforms;
      linux;
  };
}


{ cabal, errorcallEqInstance, hspec, setenv }:

cabal.mkDerivation (self: {
  pname = "base-compat";
  version = "0.4.2";
  sha256 = "0rcra6bgx955c2yd52y6v7lmlm5r86sdmii3qapx6yghqhdslzry";
  buildDepends = [ errorcallEqInstance setenv ];
  testDepends = [ hspec setenv ];
  meta = {
    description = "A compatibility layer for base";
    license = self.stdenv.lib.licenses.mit;
    platforms = self.ghc.meta.platforms;
  };
})

Update haskell-base-compat to version 0.5.0

{ cabal, errorcallEqInstance, hspec, QuickCheck, setenv }:

cabal.mkDerivation (self: {
  pname = "base-compat";
  version = "0.5.0";
  sha256 = "1zlpfpfnaqf8rrha19arh882bc560dcw2zwi4j3qrn3lzyh8s1d1";
  buildDepends = [ errorcallEqInstance setenv ];
  testDepends = [ hspec QuickCheck ];
  meta = {
    description = "A compatibility layer for base";
    license = self.stdenv.lib.licenses.mit;
    platforms = self.ghc.meta.platforms;
  };
})


{ stdenv, fetchFromGitHub, qmake, qtbase, qtsvg, qtx11extras, libX11, libXext, qttools }:

stdenv.mkDerivation rec {
  name = "qtstyleplugin-kvantum-${version}";
  version = "0.10.4";

  src = fetchFromGitHub {
    owner = "tsujan";
    repo = "Kvantum";
    rev = "0527bb03f2252269fd382e11181a34ca72c96b4b";
    sha256 = "0ky44s1fgqxraywagx1mv07yz76ppgiz3prq447db78wkwqg2d8p";
  };

  nativeBuildInputs = [ qmake qttools ];
  buildInputs = [ qtbase qtsvg qtx11extras libX11 libXext  ];

  postUnpack = "sourceRoot=\${sourceRoot}/Kvantum";

  postInstall= ''
    mkdir -p $out/$qtPluginPrefix/styles
    mv $NIX_QT5_TMP/$qtPluginPrefix/styles/libkvantum.so $out/$qtPluginPrefix/styles/libkvantum.so
  '';

  meta = with stdenv.lib; {
    description = "SVG-based Qt5 theme engine plus a config tool and extra themes";
    homepage = "https://github.com/tsujan/Kvantum";
    license = licenses.gpl2;
    platforms = platforms.linux;
    maintainers = [ maintainers.bugworm ];
    broken = true; # 2018-04-10
  };
}

Revert "qtstyleplugin-kvantum: mark as broken"

{ stdenv, fetchFromGitHub, qmake, qtbase, qtsvg, qtx11extras, libX11, libXext, qttools }:

stdenv.mkDerivation rec {
  name = "qtstyleplugin-kvantum-${version}";
  version = "0.10.4";

  src = fetchFromGitHub {
    owner = "tsujan";
    repo = "Kvantum";
    rev = "0527bb03f2252269fd382e11181a34ca72c96b4b";
    sha256 = "0ky44s1fgqxraywagx1mv07yz76ppgiz3prq447db78wkwqg2d8p";
  };

  nativeBuildInputs = [ qmake qttools ];
  buildInputs = [ qtbase qtsvg qtx11extras libX11 libXext  ];

  postUnpack = "sourceRoot=\${sourceRoot}/Kvantum";

  postInstall= ''
    mkdir -p $out/$qtPluginPrefix/styles
    mv $NIX_QT5_TMP/$qtPluginPrefix/styles/libkvantum.so $out/$qtPluginPrefix/styles/libkvantum.so
  '';

  meta = with stdenv.lib; {
    description = "SVG-based Qt5 theme engine plus a config tool and extra themes";
    homepage = "https://github.com/tsujan/Kvantum";
    license = licenses.gpl2;
    platforms = platforms.linux;
    maintainers = [ maintainers.bugworm ];
  };
}


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

stdenv.mkDerivation rec {
  name = "xfwm4-themes-4.10.0";

  src = fetchurl {
    url = "http://archive.xfce.org/src/art/xfwm4-themes/4.10/${name}.tar.bz2";
    sha256 = "0xfmdykav4rf6gdxbd6fhmrfrvbdc1yjihz7r7lba0wp1vqda51j";
  };

  buildInputs = [ pkgconfig intltool gtk ];

  meta = {
    homepage = http://www.xfce.org/;
    description = "Themes for Xfce";
    platforms = stdenv.lib.platforms.linux;
    maintainers = [ stdenv.lib.maintainers.eelco ];
  };
}

Drop eelco as a maintaner due copy&paste

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

stdenv.mkDerivation rec {
  name = "xfwm4-themes-4.10.0";

  src = fetchurl {
    url = "http://archive.xfce.org/src/art/xfwm4-themes/4.10/${name}.tar.bz2";
    sha256 = "0xfmdykav4rf6gdxbd6fhmrfrvbdc1yjihz7r7lba0wp1vqda51j";
  };

  buildInputs = [ pkgconfig intltool gtk ];

  meta = {
    homepage = http://www.xfce.org/;
    description = "Themes for Xfce";
    platforms = stdenv.lib.platforms.linux;
  };
}


{ lib, fetchzip }:

let
  version = "1.5.4";
in
fetchzip {
  name = "victor-mono-${version}";
  stripRoot = false;

  # Upstream prefers we download from the website,
  # but we really insist on a more versioned resource.
  # Happily, tagged releases on github contain the same
  # file `VictorMonoAll.zip` as from the website,
  # so we extract it from the tagged release.
  # Both methods produce the same file, but this way
  # we can safely reason about what version it is.
  url = "https://github.com/rubjo/victor-mono/raw/v${version}/public/VictorMonoAll.zip";

  postFetch = ''
    mkdir -p "$out/share/fonts/"

    mv $out/OTF $out/share/fonts/opentype
    mv $out/TTF $out/share/fonts/truetype

    rm -r $out/{EOT,WOFF,WOFF2}
  '';

  sha256 = "sha256-1si0d2lpuXaDcSc3giVMMMbZc/eKbHKU3wmwfYHZ8o0=";

  meta = with lib; {
    description = "Free programming font with cursive italics and ligatures";
    homepage = "https://rubjo.github.io/victor-mono";
    license = licenses.ofl;
    maintainers = with maintainers; [ jpotier dtzWill ];
    platforms = platforms.all;
  };
}

Move LICENSE.txt to fonts directory

{ lib, fetchzip }:

let
  version = "1.5.4";
in
fetchzip {
  name = "victor-mono-${version}";
  stripRoot = false;

  # Upstream prefers we download from the website,
  # but we really insist on a more versioned resource.
  # Happily, tagged releases on github contain the same
  # file `VictorMonoAll.zip` as from the website,
  # so we extract it from the tagged release.
  # Both methods produce the same file, but this way
  # we can safely reason about what version it is.
  url = "https://github.com/rubjo/victor-mono/raw/v${version}/public/VictorMonoAll.zip";

  postFetch = ''
    mkdir -p "$out/share/fonts/"

    mv $out/OTF $out/share/fonts/opentype
    mv $out/TTF $out/share/fonts/truetype
    mv $out/LICENSE.txt $out/share/fonts/$name-LICENSE.txt

    rm -r $out/{EOT,WOFF,WOFF2}
  '';

  sha256 = "sha256-1si0d2lpuXaDcSc3giVMMMbZc/eKbHKU3wmwfYHZ8o0=";

  meta = with lib; {
    description = "Free programming font with cursive italics and ligatures";
    homepage = "https://rubjo.github.io/victor-mono";
    license = licenses.ofl;
    maintainers = with maintainers; [ jpotier dtzWill ];
    platforms = platforms.all;
  };
}


{ lib
, buildPythonPackage, fetchPypi
, numpy, requests, six, pyglet, scipy, cloudpickle
}:

buildPythonPackage rec {
  pname = "gym";
  version = "0.15.4";

  src = fetchPypi {
    inherit pname version;
    sha256 = "3b930cbe1c76bbd30455b5e82ba723dea94159a5f988e927f443324bf7cc7ddd";
  };

  postPatch = ''
    substituteInPlace setup.py \
      --replace "pyglet>=1.2.0,<=1.3.2" "pyglet"
  '';

  propagatedBuildInputs = [
    numpy requests six pyglet scipy cloudpickle
  ];

  # The test needs MuJoCo that is not free library.
  doCheck = false;

  meta = with lib; {
    description = "A toolkit by OpenAI for developing and comparing your reinforcement learning agents";
    homepage = https://gym.openai.com/;
    license = licenses.mit;
    maintainers = with maintainers; [ hyphon81 ];
  };
}

Revert "python: gym: 0.15.3 -> 0.15.4"

{ lib
, buildPythonPackage, fetchPypi
, numpy, requests, six, pyglet, scipy, cloudpickle
}:

buildPythonPackage rec {
  pname = "gym";
  version = "0.15.3";

  src = fetchPypi {
    inherit pname version;
    sha256 = "18381e13bbd1e2f206a1b88a2af4fb87affd7d06ee7955a6e5e6a79478a9adfc";
  };

  postPatch = ''
    substituteInPlace setup.py \
      --replace "pyglet>=1.2.0,<=1.3.2" "pyglet"
  '';

  propagatedBuildInputs = [
    numpy requests six pyglet scipy cloudpickle
  ];

  # The test needs MuJoCo that is not free library.
  doCheck = false;

  meta = with lib; {
    description = "A toolkit by OpenAI for developing and comparing your reinforcement learning agents";
    homepage = https://gym.openai.com/;
    license = licenses.mit;
    maintainers = with maintainers; [ hyphon81 ];
  };
}


{ stdenv, appleDerivation }:

appleDerivation {
  preConfigure = "cd libiconv";

  postInstall = ''
    mv $out/lib/libiconv.dylib $out/lib/libiconv-nocharset.dylib
    install_name_tool -id $out/lib/libiconv-nocharset.dylib $out/lib/libiconv-nocharset.dylib

    # re-export one useless symbol; ld will reject a dylib that only reexports other dylibs
    echo 'void dont_use_this(){}' | clang -dynamiclib -x c - -current_version 2.4.0 \
      -compatibility_version 7.0.0 -current_version 7.0.0 -o $out/lib/libiconv.dylib \
      -Wl,-reexport_library -Wl,$out/lib/libiconv-nocharset.dylib \
      -Wl,-reexport_library -Wl,$out/lib/libcharset.dylib
  '';

  setupHook = ../../../../development/libraries/libiconv/setup-hook.sh;

  meta = {
    platforms = stdenv.lib.platforms.darwin;
  };
}

Revert "darwin.libiconv: fix setup hook"

{ stdenv, appleDerivation }:

appleDerivation {
  preConfigure = "cd libiconv";

  postInstall = ''
    mv $out/lib/libiconv.dylib $out/lib/libiconv-nocharset.dylib
    install_name_tool -id $out/lib/libiconv-nocharset.dylib $out/lib/libiconv-nocharset.dylib

    # re-export one useless symbol; ld will reject a dylib that only reexports other dylibs
    echo 'void dont_use_this(){}' | clang -dynamiclib -x c - -current_version 2.4.0 \
      -compatibility_version 7.0.0 -current_version 7.0.0 -o $out/lib/libiconv.dylib \
      -Wl,-reexport_library -Wl,$out/lib/libiconv-nocharset.dylib \
      -Wl,-reexport_library -Wl,$out/lib/libcharset.dylib
  '';

  setup-hook = ../../../../development/libraries/libiconv/setup-hook.sh;

  meta = {
    platforms = stdenv.lib.platforms.darwin;
  };
}


{ stdenv, fetchurl, pcsclite, pkgconfig, libusb1, perl }:
stdenv.mkDerivation rec {
  version = "1.4.14";
  name = "ccid-${version}";

  src = fetchurl {
    url = "http://ftp.de.debian.org/debian/pool/main/c/ccid/ccid_${version}.orig.tar.bz2";
    sha256 = "0inibkhzk4ghg85jkysscjrzshmxfdzz6b54dqj182l0isn082y5";
  };

  patchPhase = ''
    sed -i 's,/usr/bin/env perl,${perl}/bin/perl,' src/*.pl
    substituteInPlace src/Makefile.in --replace /bin/echo echo
  '';
  preConfigure = ''
    configureFlags="$configureFlags --enable-usbdropdir=$out/pcsc/drivers"
  '';

  buildInputs = [ pcsclite pkgconfig libusb1 ];

  meta = {
    description = "ccid drivers for pcsclite";
    homepage = http://pcsclite.alioth.debian.org/;
    license = "GPLv2+";
    maintainers = with stdenv.lib.maintainers; [viric];
    platforms = with stdenv.lib.platforms; linux;
  };
}

Update from 1.4.14 -> 1.4.15

{ stdenv, fetchurl, pcsclite, pkgconfig, libusb1, perl }:
stdenv.mkDerivation rec {
  version = "1.4.15";
  name = "ccid-${version}";

  src = fetchurl {
    url = "http://ftp.de.debian.org/debian/pool/main/c/ccid/ccid_${version}.orig.tar.bz2";
    sha256 = "02lrdmqlw2ilbmgcpi2h7w741p025c10frxdn5w3wnzi8qi1hdjl";
  };

  patchPhase = ''
    sed -i 's,/usr/bin/env perl,${perl}/bin/perl,' src/*.pl
    substituteInPlace src/Makefile.in --replace /bin/echo echo
  '';
  preConfigure = ''
    configureFlags="$configureFlags --enable-usbdropdir=$out/pcsc/drivers"
  '';

  buildInputs = [ pcsclite pkgconfig libusb1 ];

  meta = {
    description = "ccid drivers for pcsclite";
    homepage = http://pcsclite.alioth.debian.org/;
    license = "GPLv2+";
    maintainers = with stdenv.lib.maintainers; [viric];
    platforms = with stdenv.lib.platforms; linux;
  };
}


{ stdenv, lib, fetchFromGitHub, asciidoc, cmake, docbook_xsl, pkg-config
, bash-completion, openssl, curl, libxml2, libxslt }:

stdenv.mkDerivation rec {
  pname = "lastpass-cli";
  version = "1.3.3";

  src = fetchFromGitHub {
    owner = "lastpass";
    repo = pname;
    rev = "v${version}";
    sha256 = "168jg8kjbylfgalhicn0llbykd7kdc9id2989gg0nxlgmnvzl58a";
  };

  nativeBuildInputs = [ asciidoc cmake docbook_xsl pkg-config ];

  buildInputs = [
    bash-completion curl openssl libxml2 libxslt
  ];

  installTargets = [ "install" "install-doc" ];

  postInstall = ''
    install -Dm644 -T ../contrib/lpass_zsh_completion $out/share/zsh/site-functions/_lpass
    install -Dm644 -T ../contrib/completions-lpass.fish $out/share/fish/vendor_completions.d/lpass.fish
  '';

  meta = with lib; {
    description = "Stores, retrieves, generates, and synchronizes passwords securely";
    homepage    = "https://github.com/lastpass/lastpass-cli";
    license     = licenses.gpl2Plus;
    platforms   = platforms.unix;
    maintainers = with maintainers; [ cstrahan ];
  };
}

Add gitcredentials helper and format

{ stdenv
, lib
, fetchFromGitHub
, asciidoc
, cmake
, docbook_xsl
, pkg-config
, bash-completion
, openssl
, curl
, libxml2
, libxslt
}:

stdenv.mkDerivation rec {
  pname = "lastpass-cli";
  version = "1.3.3";

  src = fetchFromGitHub {
    owner = "lastpass";
    repo = pname;
    rev = "v${version}";
    sha256 = "168jg8kjbylfgalhicn0llbykd7kdc9id2989gg0nxlgmnvzl58a";
  };

  nativeBuildInputs = [ asciidoc cmake docbook_xsl pkg-config ];

  buildInputs = [
    bash-completion
    curl
    openssl
    libxml2
    libxslt
  ];

  installTargets = [ "install" "install-doc" ];

  postInstall = ''
    install -Dm644 -T ../contrib/lpass_zsh_completion $out/share/zsh/site-functions/_lpass
    install -Dm644 -T ../contrib/completions-lpass.fish $out/share/fish/vendor_completions.d/lpass.fish
    install -Dm755 -T ../contrib/examples/git-credential-lastpass $out/bin/git-credential-lastpass
  '';

  meta = with lib; {
    description = "Stores, retrieves, generates, and synchronizes passwords securely";
    homepage = "https://github.com/lastpass/lastpass-cli";
    license = licenses.gpl2Plus;
    platforms = platforms.unix;
    maintainers = with maintainers; [ cstrahan ];
  };
}


x@{builderDefsPackage
  , mesa, SDL, SDL_mixer, plib, libjpeg
  , ...}:
builderDefsPackage
(a :
let
  helperArgNames = ["stdenv" "fetchurl" "builderDefsPackage"] ++
    [];

  buildInputs = map (n: builtins.getAttr n x)
    (builtins.attrNames (builtins.removeAttrs x helperArgNames));
  sourceInfo = rec {
    baseName="crrcsim";
    version="0.9.11";
    name="${baseName}-${version}";
    url="mirror://sourceforge/${baseName}.berlios/${name}.tar.gz";
    hash="16z9gixp60920lqckij8kdw90jys0llls4lw5c8vqgk14ck5hhiz";
  };
in
rec {
  src = a.fetchurl {
    url = sourceInfo.url;
    sha256 = sourceInfo.hash;
  };

  inherit (sourceInfo) name version;
  inherit buildInputs;

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

  meta = {
    description = "A model-airplane flight simulator";
    maintainers = with a.lib.maintainers;
    [
      raskin
    ];
    platforms = with a.lib.platforms;
      linux;
    license = "GPLv2";
  };
  passthru = {
    updateInfo = {
      downloadPage = "http://crrcsim.berlios.de/wiki/index.php?n=CRRCsim.DownLoad"; #TODO: berlios shut down
    };
  };
}) x

Update to 0.9.12 & simplify.

{ stdenv, fetchurl, mesa, SDL, SDL_mixer, plib, libjpeg }:
let
  version = "0.9.12";
in
stdenv.mkDerivation rec {
  name = "crrcsim-${version}";

  src = fetchurl {
    url = "mirror://sourceforge/crrcsim/${name}.tar.gz";
    sha256 = "1yx3cn7ilwj92v6rk3zm565ap92vmky4r39na814lfglkzn6l5id";
  };

  buildInputs = [
    mesa SDL SDL_mixer plib libjpeg
  ];

  meta = {
    description = "A model-airplane flight simulator";
    maintainers = with stdenv.lib.maintainers; [ raskin the-kenny ];
    platforms = stdenv.lib.platforms.linux;
    license = "GPLv2";
  };
}


{ pkgs, ... }:

{
  environment.systemPackages = with pkgs; [
    (ffmpeg-full.override {
      nonfreeLicensing = true;
      nvenc = true;
    })
    kdenlive
    breeze-icons # icon set used in kdenlive
    audacity
  ];
}

Fix issue of missing frei0r-plugins in Kdenlive

{ pkgs, ... }:

{
  # fix issue of missing frei0r plugins,
  # see https://github.com/NixOS/nixpkgs/issues/29614#issuecomment-511118058
  nixpkgs.config.packageOverrides = pkgs: {
    kdenlive = pkgs.kdenlive.overrideAttrs (oldAttrs: rec {
        postInstall = ''
         wrapProgram $out/bin/kdenlive --prefix FREI0R_PATH : ${pkgs.frei0r}/lib/frei0r-1
       '';
       nativeBuildInputs = oldAttrs.nativeBuildInputs or [] ++ [ pkgs.makeWrapper ];
    });
  };

  environment.systemPackages = with pkgs; [
    (ffmpeg-full.override {
      nonfreeLicensing = true;
      nvenc = true;
    })
    kdenlive
    breeze-icons # icon set used in kdenlive
    audacity
  ];
}


{ lib, fetchPypi, buildPythonPackage, protobuf, hidapi, ecdsa, mnemonic
, requests
}:

buildPythonPackage rec {
  name = "${pname}-${version}";
  pname = "trezor";
  version = "0.9.0";

  src = fetchPypi {
    inherit pname version;
    sha256 = "2dd01e11d669cb8f5e40fcf1748bcabc41fb5f41edb010fc807dc3088f9bd7de";
  };

  propagatedBuildInputs = [ protobuf hidapi requests mnemonic ];

  buildInputs = [ ecdsa ];

  # There are no actual tests: "ImportError: No module named tests"
  doCheck = false;

  meta = {
    description = "Python library for communicating with TREZOR Bitcoin Hardware Wallet";
    homepage = https://github.com/trezor/python-trezor;
    license = lib.licenses.gpl3;
    maintainers = with lib.maintainers; [ np ];
  };
}

Add pyblake2, click, libusb1 and ecdsa as propagatedBuildInput

{ lib, fetchPypi, buildPythonPackage,
  protobuf, hidapi, ecdsa, mnemonic, requests, pyblake2, click, libusb1
}:

buildPythonPackage rec {
  name = "${pname}-${version}";
  pname = "trezor";
  version = "0.9.0";

  src = fetchPypi {
    inherit pname version;
    sha256 = "2dd01e11d669cb8f5e40fcf1748bcabc41fb5f41edb010fc807dc3088f9bd7de";
  };

  propagatedBuildInputs = [ protobuf hidapi ecdsa mnemonic requests pyblake2 click libusb1 ];

  # There are no actual tests: "ImportError: No module named tests"
  doCheck = false;

  meta = {
    description = "Python library for communicating with TREZOR Bitcoin Hardware Wallet";
    homepage = https://github.com/trezor/python-trezor;
    license = lib.licenses.gpl3;
    maintainers = with lib.maintainers; [ np ];
  };
}


{stdenv, fetchurl}:

stdenv.mkDerivation rec {
  pname = "unrar";
  version = "5.8.5";

  src = fetchurl {
    url = "https://www.rarlab.com/rar/unrarsrc-${version}.tar.gz";
    sha256 = "0abvz6vv8kr416fphysfbwgxc6hyf1bpnd0aczfv7j3vc8x949d7";
  };

  postPatch = ''
    substituteInPlace makefile \
      --replace "CXX=" "#CXX=" \
      --replace "STRIP=" "#STRIP=" \
      --replace "AR=" "#AR="
  '';

  buildPhase = ''
    make unrar
    make clean
    make lib
  '';

  installPhase = ''
    install -Dt "$out/bin" unrar

    mkdir -p $out/share/doc/unrar
    cp acknow.txt license.txt \
        $out/share/doc/unrar

    install -Dm755 libunrar.so $out/lib/libunrar.so
    install -D dll.hpp $out/include/unrar/dll.hpp
  '';

  setupHook = ./setup-hook.sh;

  meta = with stdenv.lib; {
    description = "Utility for RAR archives";
    homepage = http://www.rarlab.com/;
    license = licenses.unfreeRedistributable;
    maintainers = [ maintainers.ehmry ];
    platforms = platforms.all;
  };
}

Install all C++ header files into the "dev" output

{stdenv, fetchurl}:

stdenv.mkDerivation rec {
  pname = "unrar";
  version = "5.8.5";

  src = fetchurl {
    url = "https://www.rarlab.com/rar/unrarsrc-${version}.tar.gz";
    sha256 = "0abvz6vv8kr416fphysfbwgxc6hyf1bpnd0aczfv7j3vc8x949d7";
  };

  postPatch = ''
    substituteInPlace makefile \
      --replace "CXX=" "#CXX=" \
      --replace "STRIP=" "#STRIP=" \
      --replace "AR=" "#AR="
  '';

  buildPhase = ''
    make unrar
    make clean
    make lib
  '';

  outputs = [ "out" "dev" ];

  installPhase = ''
    install -Dt "$out/bin" unrar

    mkdir -p $out/share/doc/unrar
    cp acknow.txt license.txt \
        $out/share/doc/unrar

    install -Dm755 libunrar.so $out/lib/libunrar.so

    install -Dt $dev/include/unrar/ *.hpp
  '';

  setupHook = ./setup-hook.sh;

  meta = with stdenv.lib; {
    description = "Utility for RAR archives";
    homepage = http://www.rarlab.com/;
    license = licenses.unfreeRedistributable;
    maintainers = [ maintainers.ehmry ];
    platforms = platforms.all;
  };
}


{ stdenv, fetchurl }:

stdenv.mkDerivation rec {
  name = "yap-5.1.1";

  src = fetchurl {
    url = "mirror://sourceforge/yap/Yap-5.1.1.tar.gz";
    sha256 = "0bajxmlla9gay4m4l7y7x6qldxzi0jcq2ykgpjk9liky7g5kbnya";
  };

  meta = {
    description = "Yap Prolog System is a ISO-compatible high-performance Prolog compiler";
    homepage = http://yap.sourceforge.net/;
    license = "artistic";
  };
}

Update YAP to version 6.2.2

{ stdenv, fetchurl, readline }:

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

  src = fetchurl {
    url = "http://www.dcc.fc.up.pt/~vsc/Yap/${name}.tar.gz";
    sha256 = "0l6p0vy667wws64cvwf74ssl6h9gypjzrsl3b2d32hs422186pzi";
  };

  buildInputs = [ readline ];

  meta = {
    description = "Yap Prolog System is a ISO-compatible high-performance Prolog compiler";
    homepage = http://yap.sourceforge.net/;
    license = "artistic";
  };
}


{ stdenv, fetchurl, pkgconfig, zlib, freetype, libjpeg, jbig2dec, openjpeg
, libX11, libXext }:
stdenv.mkDerivation rec {
  name = "mupdf-1.1";

  src = fetchurl {
    url = "http://mupdf.com/download/archive/${name}-source.tar.gz";
    sha256 = "e54666bbe1d9f0a5464349bfbeffcf676c4a0fcad3efb89eba1f20d4ac991f34";
  };

  buildInputs = [ pkgconfig zlib freetype libjpeg jbig2dec openjpeg libX11 libXext ];

  preBuild = ''
    export makeFlags="prefix=$out"
    export NIX_CFLAGS_COMPILE=" $NIX_CFLAGS_COMPILE -I$(echo ${openjpeg}/include/openjpeg-*) "
  '';

  meta = {
    homepage = http://mupdf.com/;
    description = "Lightweight PDF viewer and toolkit written in portable C";
    license = "GPLv3+";
    maintainers = with stdenv.lib.maintainers; [ viric ];
    platforms = with stdenv.lib.platforms; linux;
  };
}

Update to 1.3, and add mupdf.desktop file

{ stdenv, fetchurl, pkgconfig, zlib, freetype, libjpeg, jbig2dec, openjpeg
, libX11, libXext }:
stdenv.mkDerivation rec {
  name = "mupdf-1.3";

  src = fetchurl {
    url = "http://mupdf.com/download/archive/${name}-source.tar.gz";
    sha256 = "0y247nka5gkr1ajn47jrlp5rcnf6h4ff7dfsprma3h4wxqdv7a5b";
  };

  buildInputs = [ pkgconfig zlib freetype libjpeg jbig2dec openjpeg libX11 libXext ];

  preBuild = ''
    export makeFlags="prefix=$out"
    export NIX_CFLAGS_COMPILE=" $NIX_CFLAGS_COMPILE -I$(echo ${openjpeg}/include/openjpeg-*) "
  '';

  postInstall = ''
    mkdir -p $out/share/applications
    cat > $out/share/applications/mupdf.desktop <<EOF
    [Desktop Entry]
    Type=Application
    Version=1.0
    Name=mupdf
    Comment=PDF viewer
    Exec=$out/bin/mupdf-x11
    Terminal=false
    EOF
  '';

  meta = {
    homepage = http://mupdf.com/;
    description = "Lightweight PDF viewer and toolkit written in portable C";
    license = "GPLv3+";
    maintainers = with stdenv.lib.maintainers; [ viric ];
    platforms = with stdenv.lib.platforms; linux;
  };
}


args: with args;

let version = "6.4.1-1"; in

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

  src = fetchurl {
    urls = [
      "ftp://ftp.imagemagick.org/pub/ImageMagick/${name}.tar.bz2"
      "http://ftp.surfnet.nl/pub/ImageMagick/${name}.tar.bz2"
    ];
    sha256 = "0a8defbfa867bb5e969f898d9a3b65a8c4f6952cb71411b40f005dd0a183644e";
  };

  configureFlags = ''
    --with-dots
    --with-gs-font-dir=${ghostscript}/share/ghostscript/fonts
    --with-gslib
    ${if args ? tetex then "--with-frozenpaths" else ""}
  '';

  buildInputs =
    [ bzip2 freetype ghostscript graphviz libjpeg libpng
      libtiff libX11 libxml2 zlib libtool
    ]
    ++ stdenv.lib.optional (args ? tetex) args.tetex
    ++ stdenv.lib.optional (args ? librsvg) args.librsvg;

  preConfigure = if args ? tetex then
    ''
      export DVIDecodeDelegate=${args.tetex}/bin/dvips
    '' else "";

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

Use the `imagemagick' mirror scheme.

args: with args;

let version = "6.4.1-1"; in

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

  src = fetchurl {
    url = "mirror://imagemagick/${name}.tar.bz2";
    sha256 = "0a8defbfa867bb5e969f898d9a3b65a8c4f6952cb71411b40f005dd0a183644e";
  };

  configureFlags = ''
    --with-dots
    --with-gs-font-dir=${ghostscript}/share/ghostscript/fonts
    --with-gslib
    ${if args ? tetex then "--with-frozenpaths" else ""}
  '';

  buildInputs =
    [ bzip2 freetype ghostscript graphviz libjpeg libpng
      libtiff libX11 libxml2 zlib libtool
    ]
    ++ stdenv.lib.optional (args ? tetex) args.tetex
    ++ stdenv.lib.optional (args ? librsvg) args.librsvg;

  preConfigure = if args ? tetex then
    ''
      export DVIDecodeDelegate=${args.tetex}/bin/dvips
    '' else "";

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


{ stdenv
, fetchurl

, expat
, systemd_lib
}:

stdenv.mkDerivation rec {
  name = "dbus-1.10.6";

  src = fetchurl {
    url = "https://dbus.freedesktop.org/releases/dbus/${name}.tar.gz";
    sha256 = "0pykylm78hf6pgj85gpqygv2rh7bksadnwnqck6pdpbylw4gmzmm";
  };

  buildInputs = [
    expat
    systemd_lib
  ];

  preConfigure = ''
    configureFlagsArray+=(
      "--with-systemdsystemunitdir=$out/etc/systemd/system"
    )
    installFlagsArray+=(
      "sysconfdir=$out/etc"
      "localstatedir=$TMPDIR/var"
    )
  '';

  configureFlags = [
    "--localstatedir=/var"
    "--sysconfdir=/etc"
    "--with-session-socket-dir=/tmp"
    "--enable-libaudit"
    "--enable-systemd"
    "--disable-selinux"
    "--disable-apparmor"
    "--disable-tests"
    "--disable-x11-autolaunch"
  ];

  meta = with stdenv.lib; {
    license = licenses.gpl2;
    maintainers = with maintainers; [
      wkennington
    ];
    platforms = with platforms;
      x86_64-linux;
  };
}

Add support for autolaunching as this is required for xorg

{ stdenv
, fetchurl

, expat
, systemd_lib
, xorg
}:

stdenv.mkDerivation rec {
  name = "dbus-1.10.8";

  src = fetchurl {
    url = "https://dbus.freedesktop.org/releases/dbus/${name}.tar.gz";
    sha256 = "0560y3hxpgh346w6avcrcz79c8ansmn771y5xpcvvlr6m8mx5wxs";
  };

  buildInputs = [
    expat
    systemd_lib
    xorg.libX11
  ];

  preConfigure = ''
    configureFlagsArray+=(
      "--with-systemdsystemunitdir=$out/etc/systemd/system"
    )
    installFlagsArray+=(
      "sysconfdir=$out/etc"
      "localstatedir=$TMPDIR/var"
    )
  '';

  configureFlags = [
    "--localstatedir=/var"
    "--sysconfdir=/etc"
    "--with-session-socket-dir=/tmp"
    "--enable-libaudit"
    "--enable-systemd"
    "--disable-selinux"
    "--disable-apparmor"
    "--disable-tests"
    "--enable-x11-autolaunch"
    "--enable-user-session"
  ];

  meta = with stdenv.lib; {
    license = licenses.gpl2;
    maintainers = with maintainers; [
      wkennington
    ];
    platforms = with platforms;
      x86_64-linux;
  };
}


{ config, pkgs, ... }:

let
  neopkgs = import ../mypkgs/neopkgs.nix { };
in
{
  users.extraUsers.kiba = {
    description = "Kiba Fox";
    isNormalUser = true;
    extraGroups = [
      "wheel"
    ];
    uid = 1000;
  };

  i18n = {
    consoleFont = "Lat2-Terminus16";
    consoleKeyMap = "us";
    defaultLocale = "en_US.UTF-8";
  };

  environment.variables = {
    EDITOR = "nvim";
  };

  environment.systemPackages = [
    neopkgs.neovim        # Neovim, my editor of choice
    pkgs.bash
    pkgs.curl
    pkgs.dos2unix         # Convert between dos and unix line endings
    pkgs.fish
    pkgs.git              # Source control
    pkgs.htop
    pkgs.isync            # Email sync, an alternative to OfflineIMAP
    pkgs.lynx
    pkgs.mosh             # The mobile shell
    pkgs.pngnq            # Lossy PNG compressor
    pkgs.psmisc           # includes killall
    pkgs.pwgen            # Password generator
    pkgs.python
    pkgs.silver-searcher
    pkgs.tmux
    pkgs.wget
    pkgs.which            # Some programs depend on this
  ];
}

Use a more recent version of fish

{ config, pkgs, ... }:

let
  neopkgs = import ../mypkgs/neopkgs.nix { };
in
{
  users.extraUsers.kiba = {
    description = "Kiba Fox";
    isNormalUser = true;
    extraGroups = [
      "wheel"
    ];
    uid = 1000;
  };

  i18n = {
    consoleFont = "Lat2-Terminus16";
    consoleKeyMap = "us";
    defaultLocale = "en_US.UTF-8";
  };

  environment.variables = {
    EDITOR = "nvim";
  };

  environment.systemPackages = [
    neopkgs.fish
    neopkgs.neovim        # Neovim, my editor of choice
    pkgs.bash
    pkgs.curl
    pkgs.dos2unix         # Convert between dos and unix line endings
    pkgs.git              # Source control
    pkgs.htop
    pkgs.isync            # Email sync, an alternative to OfflineIMAP
    pkgs.lynx
    pkgs.mosh             # The mobile shell
    pkgs.pngnq            # Lossy PNG compressor
    pkgs.psmisc           # includes killall
    pkgs.pwgen            # Password generator
    pkgs.python
    pkgs.silver-searcher
    pkgs.tmux
    pkgs.wget
    pkgs.which            # Some programs depend on this
  ];
}


{ config, pkgs, nixpkgs, lib, ... }:
let
  nixFlakes = (pkgs.writeScriptBin "nixFlakes" ''
      exec ${pkgs.nixUnstable}/bin/nix --experimental-features "nix-command flakes" "$@"
    '');
in {
  imports = [
    ../common.nix
    ../common-linux.nix
  ];

  services.emacs.enable = true;

  programs.zsh.shellAliases.bat = "batcat";

  home.packages = with pkgs; [
    zlib
    dmenu
    autorandr
    arandr
    picom
    espeak
    blink1-tool
    flameshot
    nyxt
    byzanz
    xrectsel
    dunst
    libnotify
    gnome-icon-theme
    _1password
    nixFlakes
    xmonad-with-packages
    sass
    esbuild
    pavucontrol
    mysql
    vscode
  ];

  home.file.".xsessionrc".text = ''
    export PATH=$HOME/.nix-profile/bin:/nix/var/nix/profiles/default/bin:$HOME/.local/bin:$PATH
    xset r rate 200 50
    '';

  nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
    "1password"
    "skypeforlinux"
    "slack"
    "spotify"
    "spotify-unwrapped"
    "vscode"
    "vscode-with-extensions"
    "zoom"
  ];
}

Sort dependencies in t14-debian alphabetically

{ config, pkgs, nixpkgs, lib, ... }:
let
  nixFlakes = (pkgs.writeScriptBin "nixFlakes" ''
      exec ${pkgs.nixUnstable}/bin/nix --experimental-features "nix-command flakes" "$@"
    '');
in {
  imports = [
    ../common.nix
    ../common-linux.nix
  ];

  services.emacs.enable = true;

  programs.zsh.shellAliases.bat = "batcat";

  home.packages = with pkgs; [
    _1password
    arandr
    autorandr
    blink1-tool
    byzanz
    dmenu
    dunst
    esbuild
    espeak
    flameshot
    gnome-icon-theme
    libnotify
    mysql
    nixFlakes
    nyxt
    pavucontrol
    picom
    sass
    vscode
    xmonad-with-packages
    xrectsel
    zlib
  ];

  home.file.".xsessionrc".text = ''
    export PATH=$HOME/.nix-profile/bin:/nix/var/nix/profiles/default/bin:$HOME/.local/bin:$PATH
    xset r rate 200 50
    '';

  nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
    "1password"
    "skypeforlinux"
    "slack"
    "spotify"
    "spotify-unwrapped"
    "vscode"
    "vscode-with-extensions"
    "zoom"
  ];
}


{ config, pkgs, ... }:

{
  programs.gpg.enable = true;
  # Hardened configuration from github.com/drduh/config
  home.file.".gnupg/gpg.conf".source = ./gpg.conf;

  services.gpg-agent = {
    enable = true;
    # TODO: This is incompatible with agents = [ "ssh" ] of keychain
    enableSshSupport = true;
  };

  # Manage SSH and GPG agents
  programs.keychain = {
    enable = true;
    # NOTE: Disable SSH agent as we use the GPG agent for that
    agents = [ "gpg" ];
    # Keys are added manually or via keepassxc
    keys = [ ];
  };

  # TODO: GPG agent replicates ssh keys from keepassxc into
  # .gnupg/private-keys-v1.d
}

Add mailvelope support to firefox

{ config, pkgs, ... }:

{
  programs.gpg.enable = true;
  # Hardened configuration from github.com/drduh/config
  home.file.".gnupg/gpg.conf".source = ./gpg.conf;

  # TODO: GPG agent replicates ssh keys from keepassxc into
  # .gnupg/private-keys-v1.d
  services.gpg-agent = {
    enable = true;
    # TODO: This is incompatible with agents = [ "ssh" ] of keychain
    enableSshSupport = true;
  };

  # Manage SSH and GPG agents
  programs.keychain = {
    enable = true;
    # NOTE: Disable SSH agent as we use the GPG agent for that
    agents = [ "gpg" ];
    # Keys are added manually or via keepassxc
    keys = [ ];
  };

  # Mainly for mailvelope
  home.packages = [ pkgs.gpgme ];
  home.file.".mozilla/native-messaging-hosts/gpgmejson.json".text = ''
    {
      "name": "gpgmejson",
      "description": "Integration with GnuPG",
      "path": "${pkgs.gpgme.dev}/bin/gpgme-json",
      "type": "stdio",
      "allowed_extensions": [
        "jid1-AQqSMBYb0a8ADg@jetpack"
      ]
    }
  '';
}


{ stdenv, fetchurl, unzip, python, asciidoc, re2c }:

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

  src = fetchurl {
    name = "${name}.zip";
    url = "https://github.com/martine/ninja/archive/v${version}.zip";
    sha256 = "15ynh806ah37bqb57hcs3mj2g82900sncp6n3bssfggb4azgjlh3";
  };

  buildInputs = [ python asciidoc unzip re2c ];

  buildPhase = ''
    python bootstrap.py
    asciidoc doc/manual.asciidoc
  '';

  installPhase = ''
    mkdir -p $out/bin
    cp ninja $out/bin/

    mkdir -p $out/share/doc/ninja
    cp doc/manual.asciidoc $out/share/doc/ninja/
    cp doc/manual.html $out/share/doc/ninja/
  '';

  meta = with stdenv.lib; {
    description = "Small build system with a focus on speed";
    longDescription = ''
      Ninja is a small build system with a focus on speed. It differs from
      other build systems in two major respects: it is designed to have its
      input files generated by a higher-level build system, and it is designed
      to run builds as fast as possible.
    '';
    homepage = http://martine.github.io/ninja/;
    license = licenses.asl20;
    platforms = platforms.linux;
    maintainers = [maintainers.bjornfor];
  };
}

Update to v1.3.4 and drop unzip dependency.

{ stdenv, fetchurl, python, asciidoc, re2c }:

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

  src = fetchurl {
    name = "${name}.tar.gz";
    url = "https://github.com/martine/ninja/archive/v${version}.tar.gz";
    sha256 = "16b0dxq3v19qjchcmfqq3m4l8s4qx2d674vfvamg0s3vvfqnc477";
  };

  buildInputs = [ python asciidoc re2c ];

  buildPhase = ''
    python bootstrap.py
    asciidoc doc/manual.asciidoc
  '';

  installPhase = ''
    mkdir -p $out/bin
    cp ninja $out/bin/

    mkdir -p $out/share/doc/ninja
    cp doc/manual.asciidoc $out/share/doc/ninja/
    cp doc/manual.html $out/share/doc/ninja/
  '';

  meta = with stdenv.lib; {
    description = "Small build system with a focus on speed";
    longDescription = ''
      Ninja is a small build system with a focus on speed. It differs from
      other build systems in two major respects: it is designed to have its
      input files generated by a higher-level build system, and it is designed
      to run builds as fast as possible.
    '';
    homepage = http://martine.github.io/ninja/;
    license = licenses.asl20;
    platforms = platforms.linux;
    maintainers = [maintainers.bjornfor];
  };
}


{ fetchurl, stdenv, python }:

stdenv.mkDerivation rec {
  name = "asciidoc-8.5.1";
  src = fetchurl {
    url = "mirror://sourceforge/asciidoc/${name}.tar.gz";
    sha256 = "ccb02db04e6e6eff2149435516e88557ca30c85bc4467420f40c895e25f17a20";
  };

  patchPhase = ''
    for n in asciidoc.py a2x.py; do
      sed -i -e "s,^#!/usr/bin/env python,#!${python}/bin/python,g" "$n"
      chmod +x "$n"
    done
  '';

  buildInputs = [ python ];

  meta = {
    longDescription = ''
      AsciiDoc is a text-based document generation system.  AsciiDoc
      input files can be translated to HTML and DocBook markups.
    '';
    homepage = http://www.methods.co.nz/asciidoc/;
    license = "GPLv2+";
  };
}

Fix install if /etc/vim exists

{ fetchurl, stdenv, python }:

stdenv.mkDerivation rec {
  name = "asciidoc-8.5.1";
  src = fetchurl {
    url = "mirror://sourceforge/asciidoc/${name}.tar.gz";
    sha256 = "ccb02db04e6e6eff2149435516e88557ca30c85bc4467420f40c895e25f17a20";
  };

  patchPhase = ''
    for n in `find . -name \*.py `; do
      sed -i -e "s,^#!/usr/bin/env python,#!${python}/bin/python,g" "$n"
      chmod +x "$n"
    done
    sed -i -e "s,/etc/vim,,g" Makefile.in
  '';

  preInstall = "ensureDir $out/etc/vim";

  buildInputs = [ python ];

  meta = {
    longDescription = ''
      AsciiDoc is a text-based document generation system.  AsciiDoc
      input files can be translated to HTML and DocBook markups.
    '';
    homepage = http://www.methods.co.nz/asciidoc/;
    license = "GPLv2+";
  };
}


{ callPackage, fetchgit, ... } @ args:

callPackage ./generic.nix (args // rec {
  version = "9.2.0";

  src = fetchgit {
    url = "https://github.com/ceph/ceph.git";
    rev = "refs/tags/v${version}";
    sha256 = "0a2v3bgkrbkzardcw7ymlhhyjlwi08qmcm7g34y2sjsxk9bd78an";
  };

  patches = [ ./fix-pythonpath.patch ];
})

Add xfsprogs 4.5.0 compat patch

{ callPackage, fetchgit, fetchpatch, ... } @ args:

callPackage ./generic.nix (args // rec {
  version = "9.2.0";

  src = fetchgit {
    url = "https://github.com/ceph/ceph.git";
    rev = "refs/tags/v${version}";
    sha256 = "0a2v3bgkrbkzardcw7ymlhhyjlwi08qmcm7g34y2sjsxk9bd78an";
  };

  patches = [
    ./fix-pythonpath.patch
    # For building with xfsprogs 4.5.0:
    (fetchpatch {
      url = "https://github.com/ceph/ceph/commit/602425abd5cef741fc1b5d4d1dd70c68e153fc8d.patch";
      sha256 = "1iyf0ml2n50ki800vjich8lvzmcdviwqwkbs6cdj0vqv2nc5ii1g";
    })
  ];
})


{ stdenv, fetchurl }:

stdenv.mkDerivation rec {
  version = "0.03.10";
  name = "stress-ng-${version}";

  src = fetchurl {
    url = "http://kernel.ubuntu.com/~cking/tarballs/stress-ng/${name}.tar.gz";
    sha256 = "1l8dmsnss15s78b8npwhgc6jyi6bfjbgmk4pgfvr1n6z2xgaw43l";
  };

  patchPhase = ''
    substituteInPlace Makefile --replace "/usr" ""
  '';

  enableParallelBuilding = true;

  makeFlags = "DESTDIR=$(out)";

  meta = with stdenv.lib; {
    description = "Stress test a computer system";
    longDescription = ''
      Stress test a computer system in various selectable ways, by exercising
      various physical subsystems of a computer as well as the various
      operating system kernel interfaces. Stress-ng features:
      - over 60 different stress tests
      - over 50 CPU specific stress tests that exercise floating point,
        integer, bit manipulation and control flow
      - over 20 virtual memory stress tests
      stress-ng was originally intended to make a machine work hard and trip
      hardware issues such as thermal overruns as well as operating system
      bugs that only occur when a system is being thrashed hard.
    '';
    homepage = http://kernel.ubuntu.com/~cking/stress-ng/;
    license = with licenses; gpl2Plus;
    platforms = with platforms; linux;
    maintainers = with maintainers; [ nckx ];
  };
}

Update stress-ng 0.03.10 -> 0.03.11

{ stdenv, fetchurl }:

stdenv.mkDerivation rec {
  version = "0.03.11";
  name = "stress-ng-${version}";

  src = fetchurl {
    url = "http://kernel.ubuntu.com/~cking/tarballs/stress-ng/${name}.tar.gz";
    sha256 = "01pshnqb75c0g4pwcz5i1gh2a6ijy3dlz8drb0i0p6n6l3fpgmar";
  };

  patchPhase = ''
    substituteInPlace Makefile --replace "/usr" ""
  '';

  enableParallelBuilding = true;

  makeFlags = "DESTDIR=$(out)";

  meta = with stdenv.lib; {
    description = "Stress test a computer system";
    longDescription = ''
      Stress test a computer system in various selectable ways, by exercising
      various physical subsystems of a computer as well as the various
      operating system kernel interfaces. Stress-ng features:
      - over 60 different stress tests
      - over 50 CPU specific stress tests that exercise floating point,
        integer, bit manipulation and control flow
      - over 20 virtual memory stress tests
      stress-ng was originally intended to make a machine work hard and trip
      hardware issues such as thermal overruns as well as operating system
      bugs that only occur when a system is being thrashed hard.
    '';
    homepage = http://kernel.ubuntu.com/~cking/stress-ng/;
    license = with licenses; gpl2Plus;
    platforms = with platforms; linux;
    maintainers = with maintainers; [ nckx ];
  };
}


{ stdenv, fetchurl, pkgconfig, python, yasm
, gst-plugins-base, orc, bzip2
, withSystemLibav ? true, libav ? null
}:

# Note that since gst-libav-1.6, libav is actually ffmpeg. See
# https://gstreamer.freedesktop.org/releases/1.6/ for more info.

assert withSystemLibav -> libav != null;

stdenv.mkDerivation rec {
  name = "gst-libav-1.14.0";

  meta = {
    homepage = https://gstreamer.freedesktop.org;
    license = stdenv.lib.licenses.lgpl2Plus;
    platforms = stdenv.lib.platforms.unix;
  };

  src = fetchurl {
    url = "${meta.homepage}/src/gst-libav/${name}.tar.xz";
    sha256 = "12gglx6rarnxbaj0h1wivlgkv467n1bz2bwjigplciq57r6ln4zv";
  };

  outputs = [ "out" "dev" ];

  configureFlags = stdenv.lib.optionalString withSystemLibav
    "--with-system-libav";

  nativeBuildInputs = with stdenv.lib;
    [ pkgconfig python ]
    ++ optional (!withSystemLibav) yasm
    ;

  buildInputs = with stdenv.lib;
    [ gst-plugins-base orc bzip2 ]
    ++ optional withSystemLibav libav
    ;
}

Switch to meson build system

{ stdenv, fetchurl, meson, ninja, pkgconfig
, python, yasm, gst-plugins-base, orc, bzip2
, gettext, withSystemLibav ? true, libav ? null
}:

# Note that since gst-libav-1.6, libav is actually ffmpeg. See
# https://gstreamer.freedesktop.org/releases/1.6/ for more info.

assert withSystemLibav -> libav != null;

stdenv.mkDerivation rec {
  name = "gst-libav-1.14.0";

  meta = {
    homepage = https://gstreamer.freedesktop.org;
    license = stdenv.lib.licenses.lgpl2Plus;
    platforms = stdenv.lib.platforms.unix;
  };

  src = fetchurl {
    url = "${meta.homepage}/src/gst-libav/${name}.tar.xz";
    sha256 = "12gglx6rarnxbaj0h1wivlgkv467n1bz2bwjigplciq57r6ln4zv";
  };

  outputs = [ "out" "dev" ];

  nativeBuildInputs = with stdenv.lib;
    [ meson ninja gettext pkgconfig python ]
    ++ optional (!withSystemLibav) yasm
    ;

  buildInputs = with stdenv.lib;
    [ gst-plugins-base orc bzip2 ]
    ++ optional withSystemLibav libav
    ;
}


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

buildPythonPackage rec {
  pname = "suds-jurko";
  version = "0.6";
  disabled = isPyPy;  # lots of failures

  src = fetchPypi {
    inherit pname version;
    extension = "zip";
    sha256 = "1s4radwf38kdh3jrn5acbidqlr66sx786fkwi0rgq61hn4n2bdqw";
  };

  buildInputs = [ pytest ];

  doCheck = false; # v0.6 is broken with recent pytest 4.x

  meta = with stdenv.lib; {
    description = "Lightweight SOAP client (Jurko's fork)";
    homepage = https://bitbucket.org/jurko/suds;
    license = licenses.lgpl3;
  };

}

Revert "python-suds-jurko: disable the test suite"

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

buildPythonPackage rec {
  pname = "suds-jurko";
  version = "0.6";
  disabled = isPyPy;  # lots of failures

  src = fetchPypi {
    inherit pname version;
    extension = "zip";
    sha256 = "1s4radwf38kdh3jrn5acbidqlr66sx786fkwi0rgq61hn4n2bdqw";
  };

  buildInputs = [ pytest ];

  preBuild = ''
    # fails
    substituteInPlace tests/test_transport_http.py \
      --replace "test_sending_unicode_data" "noop"
  '';

  meta = with stdenv.lib; {
    description = "Lightweight SOAP client (Jurko's fork)";
    homepage = https://bitbucket.org/jurko/suds;
    license = licenses.lgpl3;
  };

}


{lib, fetchPypi, buildPythonPackage, html5lib, httplib2, nose, pillow, pypdf2, reportlab}:

let
  #xhtml2pdf specifically requires version "1.0b10" of html5lib
  html5 = html5lib.overrideAttrs( oldAttrs: rec{
    version = "1.0b10";
    src = oldAttrs.src.override {
      inherit version;
      sha256 = "1yd068a5c00wd0ajq0hqimv7fd82lhrw0w3s01vbhy9bbd6xapqd";
    };
  });
in

buildPythonPackage rec {
  name = "${pname}-${version}";
  pname = "xhtml2pdf";
  version = "0.2.1";

  buildInputs = [html5];
  propagatedBuildInputs = [httplib2 nose pillow pypdf2 reportlab html5];

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

  meta = {
    description = "A pdf converter for the ReportLab Toolkit";
    homepage = https://github.com/xhtml2pdf/xhtml2pdf;
    license = lib.licenses.asl2;
    maintainers = with lib.maintainers; [ rprospero ];
  };
}

Fix typo in license for xhtml2pdf python package

{lib, fetchPypi, buildPythonPackage, html5lib, httplib2, nose, pillow, pypdf2, reportlab}:

let
  #xhtml2pdf specifically requires version "1.0b10" of html5lib
  html5 = html5lib.overrideAttrs( oldAttrs: rec{
    version = "1.0b10";
    src = oldAttrs.src.override {
      inherit version;
      sha256 = "1yd068a5c00wd0ajq0hqimv7fd82lhrw0w3s01vbhy9bbd6xapqd";
    };
  });
in

buildPythonPackage rec {
  name = "${pname}-${version}";
  pname = "xhtml2pdf";
  version = "0.2.1";

  buildInputs = [html5];
  propagatedBuildInputs = [httplib2 nose pillow pypdf2 reportlab html5];

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

  meta = {
    description = "A pdf converter for the ReportLab Toolkit";
    homepage = https://github.com/xhtml2pdf/xhtml2pdf;
    license = lib.licenses.asl20;
    maintainers = with lib.maintainers; [ rprospero ];
  };
}


{ 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/"
    ];
    trustedBinaryCaches = [
      "https://hydra.nixos.org/"
      "http://hydra.cryp.to"
      "https://nixcache.reflex-frp.org"
    ];
    binaryCachePublicKeys = [
      "ryantrinkle.com-1:JJiAKaRv9mWgpVAz8dwewnZe0AzzEAzPkagE9SP5NWI="
    ];
  };
}

Enable the Reflex FRP cache by default

{ 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="
    ];
  };
}


{fetchurl, buildPerlPackage, DBI, mysql}:

buildPerlPackage {
  name = "DBD-mysql-4.013";

  src = fetchurl {
    url = mirror://cpan/authors/id/C/CA/CAPTTOFU/DBD-mysql-4.013.tar.gz;
    sha256 = "074jm3fd9bi9am4i8alwim5i7a4gl07hzjy7a7hfdj9awbd0w9x9";
  };

  buildInputs = [mysql] ;
  propagatedBuildInputs = [DBI];

#  makeMakerFlags = "MYSQL_HOME=${mysql}";
}

Update to 4.023 (.013 fails to build).

{fetchurl, buildPerlPackage, DBI, mysql}:

buildPerlPackage {
  name = "DBD-mysql-4.023";

  src = fetchurl {
    url = mirror://cpan/authors/id/C/CA/CAPTTOFU/DBD-mysql-4.023.tar.gz;
    sha256 = "0j4i0i6apjwx5klk3wigh6yysssn7bs6p8c5sh31m6qxsbgyk9xa";
  };

  buildInputs = [mysql] ;
  propagatedBuildInputs = [DBI];

#  makeMakerFlags = "MYSQL_HOME=${mysql}";
}


# This file is autogenerated from update.sh in the same directory.
{
  dev = {
    version = "30.0.1581.2";
    url = "http://commondatastorage.googleapis.com/chromium-browser-official/chromium-30.0.1581.2.tar.xz";
    sha256 = "16l0gprinxbhdsx67yaq6qwy45018v6vww0hnyji4wdzd5drkf9r";
  };
  beta = {
    version = "29.0.1547.32";
    url = "http://commondatastorage.googleapis.com/chromium-browser-official/chromium-29.0.1547.32.tar.xz";
    sha256 = "14p5s1xn15mdrlf87hv4y9kczw5r8s461a56kkdzb5xzyq25ph8w";
  };
  stable = {
    version = "28.0.1500.95";
    url = "http://commondatastorage.googleapis.com/chromium-browser-official/chromium-28.0.1500.95.tar.xz";
    sha256 = "0d6pj57nyx7wfgxws98f6ly749flcyv7zg5sc3w16ggdxf5qhf1w";
  };
}

Update beta channel to v29.0.1547.41.

# This file is autogenerated from update.sh in the same directory.
{
  dev = {
    version = "30.0.1581.2";
    url = "http://commondatastorage.googleapis.com/chromium-browser-official/chromium-30.0.1581.2.tar.xz";
    sha256 = "16l0gprinxbhdsx67yaq6qwy45018v6vww0hnyji4wdzd5drkf9r";
  };
  beta = {
    version = "29.0.1547.41";
    url = "http://commondatastorage.googleapis.com/chromium-browser-official/chromium-29.0.1547.41.tar.xz";
    sha256 = "0xb2y7n3qyakg08606zdaw6wf60ypx9p61g56sqhxamgd5byfsg1";
  };
  stable = {
    version = "28.0.1500.95";
    url = "http://commondatastorage.googleapis.com/chromium-browser-official/chromium-28.0.1500.95.tar.xz";
    sha256 = "0d6pj57nyx7wfgxws98f6ly749flcyv7zg5sc3w16ggdxf5qhf1w";
  };
}


{ cabal, aeson, haskellSrcMeta, hspec, parsec, text, vector }:

cabal.mkDerivation (self: {
  pname = "aeson-qq";
  version = "0.7.0";
  sha256 = "1sq34pnwiyf5lngqph4m463ijr185akzbrdi3i40zmqlrymssv3c";
  buildDepends = [ aeson haskellSrcMeta parsec text vector ];
  testDepends = [ aeson hspec ];
  meta = {
    homepage = "http://github.com/zalora/aeson-qq";
    description = "JSON quasiquoter for Haskell";
    license = self.stdenv.lib.licenses.mit;
    platforms = self.ghc.meta.platforms;
  };
})

Update haskell-aeson-qq to version 0.7.1

{ cabal, aeson, haskellSrcMeta, hspec, parsec, text, vector }:

cabal.mkDerivation (self: {
  pname = "aeson-qq";
  version = "0.7.1";
  sha256 = "1b2ham1h6mlm49ax9k2agf8yymbgkk094nq2apn703i2d9v00im6";
  buildDepends = [ aeson haskellSrcMeta parsec text vector ];
  testDepends = [ aeson hspec ];
  meta = {
    homepage = "http://github.com/zalora/aeson-qq";
    description = "JSON quasiquoter for Haskell";
    license = self.stdenv.lib.licenses.mit;
    platforms = self.ghc.meta.platforms;
  };
})


{ config, pkgs, ... }:
{
  imports =
    [
      ../programs/zsh/zsh.nix
      ../programs/neovim/neovim.nix
      ../programs/git.nix
      ../programs/emacs/emacs.nix
    ];

  home = {
    stateVersion = "21.05";
    packages = with pkgs; [
      pandoc
      cabal-install
      ghc
      haskell-language-server
      stack
      ripgrep
      tree
      zathura
      nyxt
      sqlite
      byzanz
      xrectsel
      mypy
    ];
  };

  programs.fzf.enable = true;
  programs.bat = {
    enable = true;
    config.theme = "ansi-dark";
  };

  xdg.configFile."alacritty/alacritty.yml".source = ../programs/alacritty.yml;
  xdg.configFile."dunst/dunstrc".source = ../programs/dunstrc;
}

Add pyright as home-manager package

{ config, pkgs, ... }:
{
  imports =
    [
      ../programs/zsh/zsh.nix
      ../programs/neovim/neovim.nix
      ../programs/git.nix
      ../programs/emacs/emacs.nix
    ];

  home = {
    stateVersion = "21.05";
    packages = with pkgs; [
      pandoc
      cabal-install
      ghc
      haskell-language-server
      stack
      pyright
      ripgrep
      tree
      zathura
      nyxt
      sqlite
      byzanz
      xrectsel
      mypy
    ];
  };

  programs.fzf.enable = true;
  programs.bat = {
    enable = true;
    config.theme = "ansi-dark";
  };

  xdg.configFile."alacritty/alacritty.yml".source = ../programs/alacritty.yml;
  xdg.configFile."dunst/dunstrc".source = ../programs/dunstrc;
}


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

let version = "3.16.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 = "0avk8x0k91zrqvlbk8r067aw49byr8hvvr4niy48d3ib1jz2mmnl";
  };

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

  # for btrfs to get the rpath to libgcc_s, needed for pthread_cancel to work
  NIX_CFLAGS_LINK = "-lgcc_s";

  makeFlags = "prefix=$(out)";

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

Update to new upstream version 3.17.

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

let version = "3.17"; 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 = "187hdfh10hrabvldqmhg88wdv0s9r7hc5264v83ykir9wxqvzbzc";
  };

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

  # for btrfs to get the rpath to libgcc_s, needed for pthread_cancel to work
  NIX_CFLAGS_LINK = "-lgcc_s";

  makeFlags = "prefix=$(out)";

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


{ stdenv, fetchFromGitHub, rustPlatform }:

with rustPlatform;

buildRustPackage rec {
  name = "xsv-${version}";
  version = "0.12.2";

  src = fetchFromGitHub {
    owner = "BurntSushi";
    repo = "xsv";
    rev = "${version}";
    sha256 = "0z1z3b6nzaid510jaikkawvpmv4kjphzz84p0hppq6vcp5jy00s2";
  };

  depsSha256 = "013hy835871zxdnakwsr4bjm4krahlz4aqk5lh0rw78avfla89q9q";

  meta = with stdenv.lib; {
    description = "A fast CSV toolkit written in Rust";
    homepage = https://github.com/BurntSushi/xsv;
    license = with licenses; [ unlicense ];
    maintainers = [ maintainers.jgertm ];
    platforms = platforms.all;
  };
}

Revert "xsv: 0.12.1 -> 0.12.2"

{ stdenv, fetchFromGitHub, rustPlatform }:

with rustPlatform;

buildRustPackage rec {
  name = "xsv-${version}";
  version = "0.12.1";

  src = fetchFromGitHub {
    owner = "BurntSushi";
    repo = "xsv";
    rev = "${version}";
    sha256 = "0xmjx5grwjrx2zsqmpblid9pqpwkk9pv468ffqlza3w35n9x5dax";
  };

  depsSha256 = "0gdbxgykhy6wm89mbdvl7ck2v0f66hwlm0m1q7r64bkb7i10fmkd";

  meta = with stdenv.lib; {
    description = "A fast CSV toolkit written in Rust";
    homepage = https://github.com/BurntSushi/xsv;
    license = with licenses; [ unlicense ];
    maintainers = [ maintainers.jgertm ];
    platforms = platforms.all;
  };
}


# This file is autogenerated from update.sh in the same directory.
{
  dev = {
    version = "25.0.1364.36";
    url = "http://commondatastorage.googleapis.com/chromium-browser-official/chromium-25.0.1364.36.tar.bz2";
    sha256 = "1pn7qv1s6lcx8k26h89x9zdy43rzdq12f92s2l6cfdhr9ls9wv0s";
  };
  beta = {
    version = "25.0.1364.68";
    url = "http://commondatastorage.googleapis.com/chromium-browser-official/chromium-25.0.1364.68.tar.bz2";
    sha256 = "0ps3dnpih2nxb0zkw251cfrls126ysnp818bjzcbl325cbypcgc9";
  };
  stable = {
    version = "24.0.1312.69";
    url = "http://commondatastorage.googleapis.com/chromium-browser-official/chromium-24.0.1312.69.tar.bz2";
    sha256 = "1nvnhkky72nywk601vx5bbjp1m2f5dygza9h34y20inz3jgg8nbr";
  };
}

Update stable and beta channels.

# This file is autogenerated from update.sh in the same directory.
{
  dev = {
    version = "25.0.1364.36";
    url = "http://commondatastorage.googleapis.com/chromium-browser-official/chromium-25.0.1364.36.tar.bz2";
    sha256 = "1pn7qv1s6lcx8k26h89x9zdy43rzdq12f92s2l6cfdhr9ls9wv0s";
  };
  beta = {
    version = "25.0.1364.84";
    url = "http://commondatastorage.googleapis.com/chromium-browser-official/chromium-25.0.1364.84.tar.bz2";
    sha256 = "1p5k7vpk4v2m5yhhdkplq4iq4mm1vv297m9sp7max1sjbngwq6m5";
  };
  stable = {
    version = "24.0.1312.70";
    url = "http://commondatastorage.googleapis.com/chromium-browser-official/chromium-24.0.1312.70.tar.bz2";
    sha256 = "01z2xdfrlw2iynh9ink3d7hddldh2krgx3w9qnq9nq9z54vwwzfq";
  };
}


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

stdenv.mkDerivation {
  name = "krusader-2.0.0";
  src = fetchurl {
    url = mirror://sourceforge/krusader/krusader-2.0.0.tar.gz;
    sha256 = "dc74c47d6eaf1c28165a74750e5a1b0341fa1c0d436658d0d5f85a6149f4852c";
  };
  buildInputs = [ cmake qt4 perl gettext kdelibs automoc4 phonon ];
  patches = [./krusader-gcc44.patch];
  meta = {
    description = "Norton/Total Commander clone for KDE";
    license = "GPL";
    homepage = http://www.krusader.org;
    maintainers = [ lib.maintainers.sander ];
  };
}

Upgrade krusader to 2.2.0-beta1. 2.0.0 fails to compile with new qt

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

stdenv.mkDerivation rec {
  name = "krusader-2.2.0-beta1";
  src = fetchurl {
    url = "mirror://sourceforge/krusader/${name}.tar.bz2";
    sha256 = "0rbk0hw8p1bb03w74gspljbzhvpbs3dcr6ckp38gh5r80mcmqfbs";
  };
  buildInputs = [ cmake qt4 perl gettext kdelibs automoc4 phonon kdebase ];
  meta = {
    description = "Norton/Total Commander clone for KDE";
    license = "GPL";
    homepage = http://www.krusader.org;
    maintainers = with stdenv.lib.maintainers; [ sander urkud ];
  };
}


{stdenv, fetchurl, openal}:

stdenv.mkDerivation {
  name = "freealut-1.1.0";
  src = fetchurl {
    url = http://www.openal.org/openal_webstf/downloads/freealut-1.1.0.tar.gz;
    sha256 = "0kzlil6112x2429nw6mycmif8y6bxr2cwjcvp18vh6s7g63ymlb0";
  };
  buildInputs = [openal];
}

Clean up expression and add meta.

{ stdenv, fetchurl, openal }:

stdenv.mkDerivation rec {
  name = "freealut-1.1.0";

  src = fetchurl {
    url = "http://www.openal.org/openal_webstf/downloads/${name}.tar.gz";
    sha256 = "0kzlil6112x2429nw6mycmif8y6bxr2cwjcvp18vh6s7g63ymlb0";
  };

  buildInputs = [ openal ];

  meta = {
    homepage = "http://openal.org/";
    description = "Free implementation of OpenAL's ALUT standard";
    license = stdenv.lib.licenses.lgpl2;
  };
}


{ lib, stdenv, whois, perl }:

stdenv.mkDerivation {
  name = "mkpasswd-${whois.version}";

  src = whois.src;

  nativeBuildInputs = [ perl ];

  preConfigure = whois.preConfigure;
  buildPhase = "make mkpasswd";
  installPhase = "make install-mkpasswd";

  meta = with lib; {
    homepage = "https://packages.qa.debian.org/w/whois.html";
    description = "Overfeatured front-end to crypt, from the Debian whois package";
    license = licenses.gpl2;
    maintainers = with maintainers; [ cstrahan fpletz ];
    platforms = platforms.linux;
  };
}

Fix complaining about missing pkg-config

{ lib, stdenv, whois, perl, pkg-config }:

stdenv.mkDerivation {
  name = "mkpasswd-${whois.version}";

  src = whois.src;

  nativeBuildInputs = [ perl pkg-config ];

  preConfigure = whois.preConfigure;
  buildPhase = "make mkpasswd";
  installPhase = "make install-mkpasswd";

  meta = with lib; {
    homepage = "https://packages.qa.debian.org/w/whois.html";
    description = "Overfeatured front-end to crypt, from the Debian whois package";
    license = licenses.gpl2;
    maintainers = with maintainers; [ cstrahan fpletz ];
    platforms = platforms.linux;
  };
}


{ mkXfceDerivation
, lib
, intltool
, libxfce4ui
, xfce4-panel
, gettext
}:

mkXfceDerivation {
  category = "panel-plugins";
  pname = "xfce4-datetime-plugin";
  version = "0.8.1";

  rev-prefix = "xfce4-datetime-plugin-";
  sha256 = "sha256-qmZit7cCGnVTzdzPTiAiruBWlMLWzZEXJtFqAesaARo=";

  nativeBuildInputs = [
    gettext
    intltool
  ];

  buildInputs = [
    libxfce4ui
    xfce4-panel
  ];

  meta = with lib; {
    description = "Shows the date and time in the panel, and a calendar appears when you left-click on it";
    maintainers = [ maintainers.AndersonTorres ];
  };
}

Remove myself from xfce4-datetime-plugin maintainers

{ mkXfceDerivation
, lib
, intltool
, libxfce4ui
, xfce4-panel
, gettext
}:

mkXfceDerivation {
  category = "panel-plugins";
  pname = "xfce4-datetime-plugin";
  version = "0.8.1";

  rev-prefix = "xfce4-datetime-plugin-";
  sha256 = "sha256-qmZit7cCGnVTzdzPTiAiruBWlMLWzZEXJtFqAesaARo=";

  nativeBuildInputs = [
    gettext
    intltool
  ];

  buildInputs = [
    libxfce4ui
    xfce4-panel
  ];

  meta = with lib; {
    description = "Shows the date and time in the panel, and a calendar appears when you left-click on it";
    maintainers = [ ];
  };
}


{ config, pkgs, ... }:

with pkgs.lib;

let

  locatedb = "/var/cache/locatedb";

in

{

  ###### interface

  options = {

    services.locate = {

      enable = mkOption {
        default = false;
        example = true;
        description = ''
          If enabled, NixOS will periodically update the database of
          files used by the <command>locate</command> command.
        '';
      };

      period = mkOption {
        default = "15 02 * * *";
        description = ''
          This option defines (in the format used by cron) when the
          locate database is updated.
          The default is to update at 02:15 (at night) every day.
        '';
      };

    };

  };

  ###### implementation

  config = {

    systemd.services.update-locatedb =
      { description = "Update Locate Database";
        path  = [ pkgs.su ];
        script =
          ''
            mkdir -m 0755 -p $(dirname ${locatedb})
            exec updatedb --localuser=nobody --output=${locatedb}
          '';
        serviceConfig.Nice = 19;
        serviceConfig.IOSchedulingClass = "idle";
      };

    services.cron.systemCronJobs = optional config.services.locate.enable
      "${config.services.locate.period} root ${config.systemd.package}/bin/systemctl start update-locatedb.service";

  };

}

Add /media and /run to the filesystems ignored by updatedb

{ config, pkgs, ... }:

with pkgs.lib;

let

  locatedb = "/var/cache/locatedb";

in

{

  ###### interface

  options = {

    services.locate = {

      enable = mkOption {
        default = false;
        example = true;
        description = ''
          If enabled, NixOS will periodically update the database of
          files used by the <command>locate</command> command.
        '';
      };

      period = mkOption {
        default = "15 02 * * *";
        description = ''
          This option defines (in the format used by cron) when the
          locate database is updated.
          The default is to update at 02:15 (at night) every day.
        '';
      };

    };

  };

  ###### implementation

  config = {

    systemd.services.update-locatedb =
      { description = "Update Locate Database";
        path  = [ pkgs.su ];
        script =
          ''
            mkdir -m 0755 -p $(dirname ${locatedb})
            exec updatedb --localuser=nobody --output=${locatedb} --prunepaths='/tmp /var/tmp /media /run'
          '';
        serviceConfig.Nice = 19;
        serviceConfig.IOSchedulingClass = "idle";
      };

    services.cron.systemCronJobs = optional config.services.locate.enable
      "${config.services.locate.period} root ${config.systemd.package}/bin/systemctl start update-locatedb.service";

  };

}


{
  dongler = {config, pkgs, ...}: {
    # Minimal install
    environment.noXlibs = true;
    services.xserver.enable = false;
    i18n.supportedLocales = [ (config.i18n.defaultLocale + "/UTF-8") ];

    # Skip login prompt
    services.mingetty.autologinUser = "root";
    users.motd = ''
      * Plug in the CSR dongle
      * Switch your TB on a free jump slot
      * Run pair.sh
      * Run the make-hid.sh command it outputs. Make sure that is your TextBlade.
      * You can ssh in to have copy/paste available:
        * Choose a password with `passwd`
        * Examine the output of `ip a | grep inet`
          * You probably need a 192.168 address
        * ssh to root@ip
    '';

    #  Bluez 5
    hardware.bluetooth.enable = true;
    nixpkgs.config.packageOverrides = pkgs : {
      bluez = pkgs.bluez5;
      csr-hid2hci = pkgs.callPackage ../src/csr-hid2hci.nix {};
      csr-pairing = pkgs.callPackage ../src/csr-pairing.nix {};
    };

    # CLI packages
    environment.systemPackages = with pkgs; [
      csr-hid2hci csr-pairing
      bluez usbutils bc
    ];
  };
}

Allow root to log in with password

{
  dongler = {config, pkgs, ...}: {
    # Minimal install
    environment.noXlibs = true;
    services.xserver.enable = false;
    i18n.supportedLocales = [ (config.i18n.defaultLocale + "/UTF-8") ];

    # Skip login prompt
    services.mingetty.autologinUser = "root";
    users.motd = ''
      * Plug in the CSR dongle
      * Switch your TB on a free jump slot
      * Run pair.sh
      * Run the make-hid.sh command it outputs. Make sure that is your TextBlade.
      * You can ssh in to have copy/paste available:
        * Choose a password with `passwd`
        * Examine the output of `ip a | grep inet`
          * You probably need a 192.168 address
        * ssh to root@ip
    '';
    services.openssh.permitRootLogin="yes";

    #  Bluez 5
    hardware.bluetooth.enable = true;
    nixpkgs.config.packageOverrides = pkgs : {
      bluez = pkgs.bluez5;
      csr-hid2hci = pkgs.callPackage ../src/csr-hid2hci.nix {};
      csr-pairing = pkgs.callPackage ../src/csr-pairing.nix {};
    };

    # CLI packages
    environment.systemPackages = with pkgs; [
      csr-hid2hci csr-pairing
      bluez usbutils bc
    ];
  };
}


{ fetchurl, stdenv, expect, makeWrapper }:

stdenv.mkDerivation rec {
  name = "dejagnu-1.4.4";

  src = fetchurl {
    url = "mirror://gnu/dejagnu/${name}.tar.gz";
    sha256 = "13841q6pfwd9d1sdw48yxdyb4xhiccii0mb0ilql627v43pyvyyh";
  };

  buildInputs = [ expect makeWrapper ];

  doCheck = true;

  postInstall = ''
    wrapProgram "$out/bin/runtest" \
                --prefix PATH ":" "${expect}/bin"
  '';

  meta = {
    description = "The DejaGNU testing framework";

    longDescription = ''
      DejaGnu is a framework for testing other programs.  Its purpose
      is to provide a single front end for all tests.  Think of it as a
      custom library of Tcl procedures crafted to support writing a
      test harness.  A test harness is the testing infrastructure that
      is created to support a specific program or tool.  Each program
      can have multiple testsuites, all supported by a single test
      harness.  DejaGnu is written in Expect, which in turn uses Tcl --
      Tool command language.
    '';

    homepage = http://www.gnu.org/software/dejagnu/;
    license = "GPLv2+";
  };
}

Disable test suite for now.

{ fetchurl, stdenv, expect, makeWrapper }:

stdenv.mkDerivation rec {
  name = "dejagnu-1.4.4";

  src = fetchurl {
    url = "mirror://gnu/dejagnu/${name}.tar.gz";
    sha256 = "13841q6pfwd9d1sdw48yxdyb4xhiccii0mb0ilql627v43pyvyyh";
  };

  buildInputs = [ expect makeWrapper ];

  # FIXME: Enable when the /dev/pts problem is fixed.
  doCheck = false;

  # FIXME: The chroot /dev/pts is currently empty, which causes Expect
  # to fail: http://www.linuxfromscratch.org//lfs/faq.html#no-ptys .
  checkPhase = ''
    # Provide `runtest' with a log name, otherwise it tries to run
    # `whoami', which fails when in a chroot.
    LOGNAME="nix-build-daemon" make check
  '';

  postInstall = ''
    wrapProgram "$out/bin/runtest" \
                --prefix PATH ":" "${expect}/bin"
  '';

  meta = {
    description = "The DejaGNU testing framework";

    longDescription = ''
      DejaGnu is a framework for testing other programs.  Its purpose
      is to provide a single front end for all tests.  Think of it as a
      custom library of Tcl procedures crafted to support writing a
      test harness.  A test harness is the testing infrastructure that
      is created to support a specific program or tool.  Each program
      can have multiple testsuites, all supported by a single test
      harness.  DejaGnu is written in Expect, which in turn uses Tcl --
      Tool command language.
    '';

    homepage = http://www.gnu.org/software/dejagnu/;
    license = "GPLv2+";
  };
}


{ stdenv, fetchFromGitHub, cmake
, glew, glm, mesa, libX11, libXext, libXrender, cppcheck, icu}:

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

  src = fetchFromGitHub {
    owner = "naelstrof";
    repo = "slop";
    rev = "v${version}";
    sha256 = "0is3mh2d1jqgvv72v5x92w23yf26n8n384nbr1b6cn883aw8j7jz";
  };

  nativeBuildInputs = [ cmake ];
  buildInputs = [ glew glm mesa libX11 libXext libXrender icu ]
                ++ stdenv.lib.optional doCheck cppcheck;

  doCheck = false;

  meta = with stdenv.lib; {
    inherit (src.meta) homepage;
    description = "Queries a selection from the user and prints to stdout";
    platforms = stdenv.lib.platforms.all;
    license = stdenv.lib.licenses.gpl3Plus;
    maintainers = with maintainers; [ primeos mbakke ];
  };
}

Add pkgconfig as build dependency

{ stdenv, fetchFromGitHub, cmake, pkgconfig
, glew, glm, mesa, libX11, libXext, libXrender, cppcheck, icu}:

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

  src = fetchFromGitHub {
    owner = "naelstrof";
    repo = "slop";
    rev = "v${version}";
    sha256 = "0is3mh2d1jqgvv72v5x92w23yf26n8n384nbr1b6cn883aw8j7jz";
  };

  nativeBuildInputs = [ cmake pkgconfig ];
  buildInputs = [ glew glm mesa libX11 libXext libXrender icu ]
                ++ stdenv.lib.optional doCheck cppcheck;

  doCheck = false;

  meta = with stdenv.lib; {
    inherit (src.meta) homepage;
    description = "Queries a selection from the user and prints to stdout";
    platforms = stdenv.lib.platforms.all;
    license = stdenv.lib.licenses.gpl3Plus;
    maintainers = with maintainers; [ primeos mbakke ];
  };
}


a :
let
  fetchurl = a.fetchurl;

  s = import ./src-for-default.nix;
  buildInputs = with a; [
    perl intltool gettext libusb
    glib pkgconfig
  ];
in
rec {
  src = a.fetchUrlFromSrcInfo s;

  inherit buildInputs;
  configureFlags = [];

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

  setDebug = a.fullDepEntry ''
    mkdir -p $out/src
    cp -R * $out/src
    cd $out/src

    export NIX_STRIP_DEBUG=0
    export CFLAGS="-ggdb -O0 -include ${a.stdenv.glibc}/include/locale.h"
    export CXXFLAGS="-ggdb -O0"

    patch -p 1 < ${/tmp/patch}
  '' [ "minInit" "doUnpack" ];

  inherit(s) name;
  meta = {
    description = "Cellphone tool";
    maintainers = [a.lib.maintainers.raskin];
    platforms = with a.lib.platforms; linux;
  };
}

Remove the temporary patch reference

a :
let
  fetchurl = a.fetchurl;

  s = import ./src-for-default.nix;
  buildInputs = with a; [
    perl intltool gettext libusb
    glib pkgconfig
  ];
in
rec {
  src = a.fetchUrlFromSrcInfo s;

  inherit buildInputs;
  configureFlags = [];

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

  setDebug = a.fullDepEntry ''
    mkdir -p $out/src
    cp -R * $out/src
    cd $out/src

    export NIX_STRIP_DEBUG=0
    export CFLAGS="-ggdb -O0 -include ${a.stdenv.glibc}/include/locale.h"
    export CXXFLAGS="-ggdb -O0"

  '' [ "minInit" "doUnpack" ];

  inherit(s) name;
  meta = {
    description = "Cellphone tool";
    maintainers = [a.lib.maintainers.raskin];
    platforms = with a.lib.platforms; linux;
  };
}


{ bundlerEnv, ruby, lib }:

bundlerEnv rec {
  name = "${pname}-${version}";
  pname = "html-proofer";
  version = (import ./gemset.nix).html-proofer.version;

  inherit ruby;
  gemdir = ./.;

  meta = with lib; {
    description = "A tool to validate HTML files";
    homepage    = "https://github.com/gjtorikian/html-proofer";
    license     = licenses.mit;
    maintainers = with maintainers; [ primeos ];
    platforms   = platforms.unix;
  };
}

Add bundlerUpdateScript and remove myself as maintainer

{ bundlerEnv, ruby, lib, bundlerUpdateScript }:

bundlerEnv rec {
  name = "${pname}-${version}";
  pname = "html-proofer";
  version = (import ./gemset.nix).html-proofer.version;

  inherit ruby;
  gemdir = ./.;

  passthru.updateScript = bundlerUpdateScript pname;

  meta = with lib; {
    description = "A tool to validate HTML files";
    homepage    = "https://github.com/gjtorikian/html-proofer";
    license     = licenses.mit;
    maintainers = with maintainers; [ ];
    platforms   = platforms.unix;
  };
}


{stdenv, fetchsvn}:

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

  src = fetchsvn {
    url = http://hol-light.googlecode.com/svn/trunk;
    rev = "64";
    sha256 = "91e9cac62586039b13c11af245f85a743e299892b24b39d3c7b2ee13157e87c9";
  };

  buildCommand = ''
    export HOL_DIR="$out/lib/hol_light"
    ensureDir "$HOL_DIR"
    cp -a "${src}" "$HOL_DIR/src"
    cd "$HOL_DIR/src"
    chmod +wX -R .
    patch -p1 < ${./parser_setup.patch}
    substituteInPlace hol.ml --subst-var-by HOL_LIGHT_SRC_DIR "$HOL_DIR/src"
  '';

  meta = {
    description = "Sources for the HOL Light theorem prover";
    homepage = http://www.cl.cam.ac.uk/~jrh13/hol-light/;
    license = "BSD";
  };
}

Update HOL Light to r89

{stdenv, fetchsvn}:

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

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

  buildCommand = ''
    export HOL_DIR="$out/lib/hol_light"
    ensureDir "$HOL_DIR"
    cp -a "${src}" "$HOL_DIR/src"
    cd "$HOL_DIR/src"
    chmod +wX -R .
    patch -p1 < ${./parser_setup.patch}
    substituteInPlace hol.ml --subst-var-by HOL_LIGHT_SRC_DIR "$HOL_DIR/src"
  '';

  meta = {
    description = "Sources for the HOL Light theorem prover";
    homepage = http://www.cl.cam.ac.uk/~jrh13/hol-light/;
    license = "BSD";
  };
}


{ fetchFromGitHub, libgit2, ...}:

libgit2.overrideAttrs (oldAttrs: {
  cmakeFlags = oldAttrs.cmakeFlags ++ [
    "-DUSE_BUNDLED_ZLIB=ON"
    "-DUSE_ICONV=OFF"
    "-DBUILD_CLAR=OFF"
    "-DUSE_SSH=OFF"
    "-DUSE_HTTPS=OFF"
    "-DBUILD_SHARED_LIBS=OFF"
    "-DUSE_EXT_HTTP_PARSER=OFF"
  ];
  src = fetchFromGitHub {
    owner = "romkatv";
    repo = "libgit2";
    rev = "bb77509f4436901f3958e30272026f63d2247d7d";
    sha256 = "06iypr0sc6g11xipwfbgm6f039d4qy9krmwb3zww8k4y004s5jcv";
  };
})

Fix build of the internally used libgit2 fork

{ fetchFromGitHub, libgit2, ...}:

libgit2.overrideAttrs (oldAttrs: {
  cmakeFlags = oldAttrs.cmakeFlags ++ [
    "-DBUILD_CLAR=OFF"
    "-DBUILD_SHARED_LIBS=OFF"
    "-DREGEX_BACKEND=builtin"
    "-DUSE_BUNDLED_ZLIB=ON"
    "-DUSE_HTTPS=OFF"
    "-DUSE_HTTP_PARSER=builtin"  # overwritten from libgit2
    "-DUSE_ICONV=OFF"
    "-DUSE_SSH=OFF"
    "-DZERO_NSEC=ON"
  ];
  src = fetchFromGitHub {
    owner = "romkatv";
    repo = "libgit2";
    rev = "bb77509f4436901f3958e30272026f63d2247d7d";
    sha256 = "06iypr0sc6g11xipwfbgm6f039d4qy9krmwb3zww8k4y004s5jcv";
  };
})


{ fetchurl, stdenv, zlib }:

stdenv.mkDerivation rec {
  name = "protobuf-2.5.0";

  src = fetchurl {
    url = "http://protobuf.googlecode.com/files/${name}.tar.bz2";
    sha256 = "0xxn9gxhvsgzz2sgmihzf6pf75clr05mqj6218camwrwajpcbgqk";
  };

  buildInputs = [ zlib ];

  doCheck = true;

  meta = {
    description = "Protocol Buffers - Google's data interchange format";

    longDescription =
      '' Protocol Buffers are a way of encoding structured data in an
         efficient yet extensible format.  Google uses Protocol Buffers for
         almost all of its internal RPC protocols and file formats.
      '';

    license = "mBSD";

    homepage = http://code.google.com/p/protobuf/;
  };
}

Clean up and update to version 2.6.1.

{ stdenv, fetchFromGitHub, autoconf, automake, libtool, zlib, gtest }:

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

  src = fetchFromGitHub {
    owner = "google";
    repo = "protobuf";
    rev = version;
    sha256 = "03df8zvx2sry3jz2x4pi3l32qyfqa7w8kj8jdbz30nzy0h7aa070";
  };

  postPatch = ''
    sed -i -e '/gtest/d' Makefile.am
    sed -i \
      -e 's!\$(top_\(build\|src\)dir)/gtest!${gtest}!g' \
      -e 's/\(libgtest[^.]*\.\)la/\1a/g' \
      src/Makefile.am
  '';

  buildInputs = [ zlib autoconf automake libtool gtest ];

  preConfigure = "autoreconf -vfi";

  doCheck = true;

  meta = {
    description = "Protocol Buffers - Google's data interchange format";

    longDescription = ''
      Protocol Buffers are a way of encoding structured data in an
      efficient yet extensible format. Google uses Protocol Buffers for
      almost all of its internal RPC protocols and file formats.
    '';

    license = stdenv.lib.licenses.bsd3;

    homepage = "https://developers.google.com/protocol-buffers/";
  };
}


{ cabal, deepseq, erf, HUnit, ieee754, QuickCheck, testFramework
, testFrameworkHunit, testFrameworkQuickcheck2, vector
, vectorThUnbox
}:

cabal.mkDerivation (self: {
  pname = "math-functions";
  version = "0.1.5.2";
  sha256 = "12cznf7gwia1ki7xhvlhk5p8d09zrdvfgn07pkp4sfrwsc4vijcy";
  buildDepends = [ deepseq erf vector vectorThUnbox ];
  testDepends = [
    HUnit ieee754 QuickCheck testFramework testFrameworkHunit
    testFrameworkQuickcheck2 vector
  ];
  meta = {
    homepage = "https://github.com/bos/math-functions";
    description = "Special functions and Chebyshev polynomials";
    license = self.stdenv.lib.licenses.bsd3;
    platforms = self.ghc.meta.platforms;
    maintainers = [ self.stdenv.lib.maintainers.andres ];
  };
})

Disable check for haskell/math-functions, it fails on i686

{ cabal, deepseq, erf, HUnit, ieee754, QuickCheck, testFramework
, testFrameworkHunit, testFrameworkQuickcheck2, vector
, vectorThUnbox
}:

cabal.mkDerivation (self: {
  pname = "math-functions";
  version = "0.1.5.2";
  sha256 = "12cznf7gwia1ki7xhvlhk5p8d09zrdvfgn07pkp4sfrwsc4vijcy";
  buildDepends = [ deepseq erf vector vectorThUnbox ];
  testDepends = [
    HUnit ieee754 QuickCheck testFramework testFrameworkHunit
    testFrameworkQuickcheck2 vector
  ];
  # fails on i686 at version 0.1.5.2
  doCheck = false;
  meta = {
    homepage = "https://github.com/bos/math-functions";
    description = "Special functions and Chebyshev polynomials";
    license = self.stdenv.lib.licenses.bsd3;
    platforms = self.ghc.meta.platforms;
    maintainers = [ self.stdenv.lib.maintainers.andres ];
  };
})


a :
let
  fetchsvn = a.fetchsvn;

  version = a.lib.attrByPath ["version"] "r8541" a;
  buildInputs = with a; [
    gtk pkgconfig libX11 perl
  ];
in
rec {
  src = fetchsvn {
   url = svn://svn.tartarus.org/sgt/puzzles;
   rev = "8872";
   sha256 = "16hcrhkl6plzdhw60g7i4vgkxcc4mw4h4bzg2myy5cfhpx7y0m9s";
  } + "/";

  inherit buildInputs;
  configureFlags = [];
  makeFlags = ["prefix=$out" "gamesdir=$out/bin"];

  neededDirs = ["$out/bin" "$out/share" ""];
  extraDoc = ["puzzles.txt"];

  mkMakefiles = a.fullDepEntry ''
    perl mkfiles.pl
  '' ["minInit" "doUnpack" "addInputs"];

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

  name = "sgt-puzzles-" + version;
  meta = {
    description = "Simon Tatham's portable puzzle collection";
  };
}

Fix linking for SGT puzzles

a :
let
  fetchsvn = a.fetchsvn;

  version = a.lib.attrByPath ["version"] "r8541" a;
  buildInputs = with a; [
    gtk pkgconfig libX11 perl
  ];
in
rec {
  src = fetchsvn {
   url = svn://svn.tartarus.org/sgt/puzzles;
   rev = "8872";
   sha256 = "16hcrhkl6plzdhw60g7i4vgkxcc4mw4h4bzg2myy5cfhpx7y0m9s";
  } + "/";

  inherit buildInputs;
  configureFlags = [];
  makeFlags = ["prefix=$out" "gamesdir=$out/bin"];

  neededDirs = ["$out/bin" "$out/share" ""];
  extraDoc = ["puzzles.txt"];

  mkMakefiles = a.fullDepEntry ''
    perl mkfiles.pl
  '' ["minInit" "doUnpack" "addInputs"];

  setVars = a.noDepEntry ''
    export NIX_LDFLAGS="$NIX_LDFLAGS -lX11"
  '';

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

  name = "sgt-puzzles-" + version;
  meta = {
    description = "Simon Tatham's portable puzzle collection";
  };
}


{ stdenv, buildPackages, autoreconfHook, fetchurl, fetchpatch }:

stdenv.mkDerivation rec {
  name = "alsa-firmware-1.2.4";

  src = fetchurl {
    url = "mirror://alsa/firmware/${name}.tar.bz2";
    sha256 = "sha256-tnttfQi8/CR+9v8KuIqZwYgwWjz1euLf0LzZpbNs1bs=";
  };

  nativeBuildInputs = [ autoreconfHook buildPackages.stdenv.cc ];

  configureFlags = [
    "--with-hotplug-dir=$(out)/lib/firmware"
  ];

  dontStrip = true;

  postInstall = ''
    # These are lifted from the Arch PKGBUILD
    # remove files which conflicts with linux-firmware
    rm -rf $out/lib/firmware/{ct{efx,speq}.bin,ess,korg,sb16,yamaha}
    # remove broken symlinks (broken upstream)
    rm -rf $out/lib/firmware/turtlebeach
    # remove empty dir
    rm -rf $out/bin
  '';

  meta = {
    homepage = "http://www.alsa-project.org/";
    description = "Soundcard firmwares from the alsa project";
    license = stdenv.lib.licenses.gpl2Plus;
    platforms = stdenv.lib.platforms.linux;
  };
}

Revert "alsa-firmware: 1.2.1 -> 1.2.4"

{ stdenv, buildPackages, autoreconfHook, fetchurl, fetchpatch }:

stdenv.mkDerivation rec {
  name = "alsa-firmware-1.2.1";

  src = fetchurl {
    url = "mirror://alsa/firmware/${name}.tar.bz2";
    sha256 = "1aq8z8ajpjvcx7bwhwp36bh5idzximyn77ygk3ifs0my3mbpr8mf";
  };

  patches = [ (fetchpatch {
    url = "https://github.com/alsa-project/alsa-firmware/commit/a8a478485a999ff9e4a8d8098107d3b946b70288.patch";
    sha256 = "0zd7vrgz00hn02va5bkv7qj2395a1rl6f8jq1mwbryxs7hiysb78";
  }) ];

  nativeBuildInputs = [ autoreconfHook buildPackages.stdenv.cc ];

  configureFlags = [
    "--with-hotplug-dir=$(out)/lib/firmware"
  ];

  dontStrip = true;

  postInstall = ''
    # These are lifted from the Arch PKGBUILD
    # remove files which conflicts with linux-firmware
    rm -rf $out/lib/firmware/{ct{efx,speq}.bin,ess,korg,sb16,yamaha}
    # remove broken symlinks (broken upstream)
    rm -rf $out/lib/firmware/turtlebeach
    # remove empty dir
    rm -rf $out/bin
  '';

  meta = {
    homepage = "http://www.alsa-project.org/";
    description = "Soundcard firmwares from the alsa project";
    license = stdenv.lib.licenses.gpl2Plus;
    platforms = stdenv.lib.platforms.linux;
  };
}