{ stdenv, fetchgit }:

let
  version = "4517261caab34742afdeaf0c36128b9579675717";
  shortVersion = stdenv.lib.substring 0 7 version;
in
stdenv.mkDerivation {
  name = "firmware-linux-nonfree-${shortVersion}";

  src = fetchgit {
    url = "git://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git";
    rev = version;
    sha256 = "0w386nfwlqhk1wn7zzhfxkxx06nzqasc4dr0qq61wc29s9qlgi3c";
  };

  preInstall = ''
    mkdir -p $out
  '';

  installFlags = [ "DESTDIR=$(out)" ];

  meta = with stdenv.lib; {
    description = "Binary firmware collection packaged by kernel.org";
    homepage = http://packages.debian.org/sid/firmware-linux-nonfree;
    license = licenses.unfreeRedistributableFirmware;
    platforms = platforms.linux;
    maintainers = with maintainers; [ wkennington ];
  };
}

Use date instead of git version

{ stdenv, fetchgit }:

stdenv.mkDerivation {
  name = "firmware-linux-nonfree-2015-02-24";

  src = fetchgit {
    url = "git://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git";
    rev = "4517261caab34742afdeaf0c36128b9579675717";
    sha256 = "0w386nfwlqhk1wn7zzhfxkxx06nzqasc4dr0qq61wc29s9qlgi3c";
  };

  preInstall = ''
    mkdir -p $out
  '';

  installFlags = [ "DESTDIR=$(out)" ];

  meta = with stdenv.lib; {
    description = "Binary firmware collection packaged by kernel.org";
    homepage = http://packages.debian.org/sid/firmware-linux-nonfree;
    license = licenses.unfreeRedistributableFirmware;
    platforms = platforms.linux;
    maintainers = with maintainers; [ wkennington ];
  };
}


{ stdenv, fetchurl, gnumake, file }:

stdenv.mkDerivation rec {
  name = "keyutils-1.5.8";

  src = fetchurl {
    url = "http://people.redhat.com/dhowells/keyutils/${name}.tar.bz2";
    sha256 = "17419fr7mph8wlhxpqb1bdrghz0db15bmjdgxg1anfgbf9ra6zbc";
  };

  buildInputs = [ file ];

  patchPhase = ''
    sed -i -e "s,/usr/bin/make,${gnumake}/bin/make," \
        -e "s, /etc, $out/etc," \
        -e "s, /bin, $out/bin," \
        -e "s, /sbin, $out/sbin," \
        -e "s, /lib, $out/lib," \
        -e "s, /lib64, $out/lib64," \
        -e "s,/usr,$out," \
        Makefile
  '';

  meta = {
    homepage = http://people.redhat.com/dhowells/keyutils/;
    description = "Tools used to control the Linux kernel key management system";
    license = "GPLv2+";
  };
}

Update from 1.5.8 -> 1.5.9

{ stdenv, fetchurl, gnumake, file }:

stdenv.mkDerivation rec {
  name = "keyutils-1.5.9";

  src = fetchurl {
    url = "http://people.redhat.com/dhowells/keyutils/${name}.tar.bz2";
    sha256 = "1bl3w03ygxhc0hz69klfdlwqn33jvzxl1zfl2jmnb2v85iawb8jd";
  };

  buildInputs = [ file ];

  patchPhase = ''
    sed -i -e "s, /usr/bin/make, ${gnumake}/bin/make," \
        -e "s, /usr, ," \
        -e "s,\$(LNS) \$(LIBDIR)/\$(SONAME),\$(LNS) \$(SONAME)," \
        Makefile
  '';

  installPhase = "make install DESTDIR=$out";

  meta = with stdenv.lib; {
    homepage = http://people.redhat.com/dhowells/keyutils/;
    description = "Tools used to control the Linux kernel key management system";
    license = licenses.gpl2Plus;
    platforms = platforms.linux;
  };
}


{ config, pkgs, ... }:

{
  nixpkgs.config.allowUnfree = true;

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

  nix.useSandbox = true;

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

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

Make auto upgrade run every hour

{ config, pkgs, ... }:

{
  nixpkgs.config.allowUnfree = true;

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

  nix.useSandbox = true;

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

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


{ stdenv, fetchurl, autoconf, libtool, automake, libsodium, ncurses
, libtoxcore, pkgconfig }:

let
  version = "b308e19e6b";
  date = "20140224";
in
stdenv.mkDerivation rec {
  name = "toxic-${date}-${version}";

  src = fetchurl {
    url = "https://github.com/Tox/toxic/tarball/${version}";
    name = "${name}.tar.gz";
    sha256 = "0fgkvnpy3dl2h378h796z9md0zg05b3174fgx17b919av6j9x4ma";
  };

  preConfigure = ''
    autoreconf -i
  '';

  NIX_LDFLAGS = "-lsodium";

  configureFlags = [
    "--with-libtoxcore-headers=${libtoxcore}/include"
    "--with-libtoxcore-libs=${libtoxcore}/lib"
    "--with-libsodium-headers=${libtoxcore}/include"
    "--with-libsodium-libs=${libtoxcore}/lib"
  ];

  buildInputs = [ autoconf libtool automake libtoxcore libsodium ncurses pkgconfig ];

  doCheck = true;

  meta = {
    description = "Reference CLI for Tox";
    license = stdenv.lib.licenses.gpl3Plus;
    maintainers = with stdenv.lib.maintainers; [ viric ];
    platforms = stdenv.lib.platforms.all;
  };
}

Update to latest upstream Git master.

{ stdenv, fetchurl, autoconf, libtool, automake, libsodium, ncurses
, libtoxcore, openal, libvpx, freealut, libconfig, pkgconfig }:

let
  version = "7566aa9d26";
  date = "20140728";
in
stdenv.mkDerivation rec {
  name = "toxic-${date}-${version}";

  src = fetchurl {
    url = "https://github.com/Tox/toxic/tarball/${version}";
    name = "${name}.tar.gz";
    sha256 = "13vns0qc0hxhab6rpz0irnzgv42mp3v1nrbwm90iymhf4xkc9nwa";
  };

  makeFlags = [ "-Cbuild" "VERSION=${version}" ];
  installFlags = [ "PREFIX=$(out)" ];

  buildInputs = [
    autoconf libtool automake libtoxcore libsodium ncurses openal libvpx
    freealut libconfig pkgconfig
  ];

  meta = {
    description = "Reference CLI for Tox";
    license = stdenv.lib.licenses.gpl3Plus;
    maintainers = with stdenv.lib.maintainers; [ viric ];
    platforms = stdenv.lib.platforms.all;
  };
}


{ stdenv,
  fetchFromGitHub,
  which,
  autoreconfHook,
  autoconf,
  automake,
  libtool,
  yacc,
  bison,
  flex,
  glib,
  pkgconfig,
  json_c,
  xen,
  libvirt,
  xenSupport ? true }:

with stdenv.lib;

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

  src = fetchFromGitHub {
    owner = "libvmi";
    repo = "libvmi";
    rev = "6934e8a4758018983ec53ec791dd14a7d6ac31a9";
    sha256 = "0wbi2nasb1gbci6cq23g6kq7i10rwi1y7r44rl03icr5prqjpdyv";
  };

  buildInputs = [ glib which libvirt json_c ] ++ (optional xenSupport xen);
  nativeBuildInputs = [ autoreconfHook yacc bison flex libtool autoconf automake pkgconfig ];

  configureFlags = optional (!xenSupport) "--disable-xen";

  meta = with stdenv.lib; {
    homepage = "http://libvmi.com/";
    description = "A C library for virtual machine introspection";
    longDescription = ''
      LibVMI is a C library with Python bindings that makes it easy to monitor the low-level
      details of a running virtual machine by viewing its memory, trapping on hardware events,
      and accessing the vCPU registers.
    '';
    license = with licenses; [ gpl3 lgpl3 ];
    maintainers = with maintainers; [ lschuermann ];
  };
}

Use version tag as git revision

{ stdenv,
  fetchFromGitHub,
  which,
  autoreconfHook,
  autoconf,
  automake,
  libtool,
  yacc,
  bison,
  flex,
  glib,
  pkgconfig,
  json_c,
  xen,
  libvirt,
  xenSupport ? true }:

with stdenv.lib;

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

  src = fetchFromGitHub {
    owner = "libvmi";
    repo = "libvmi";
    rev = "v${version}";
    sha256 = "0wbi2nasb1gbci6cq23g6kq7i10rwi1y7r44rl03icr5prqjpdyv";
  };

  buildInputs = [ glib which libvirt json_c ] ++ (optional xenSupport xen);
  nativeBuildInputs = [ autoreconfHook yacc bison flex libtool autoconf automake pkgconfig ];

  configureFlags = optional (!xenSupport) "--disable-xen";

  meta = with stdenv.lib; {
    homepage = "http://libvmi.com/";
    description = "A C library for virtual machine introspection";
    longDescription = ''
      LibVMI is a C library with Python bindings that makes it easy to monitor the low-level
      details of a running virtual machine by viewing its memory, trapping on hardware events,
      and accessing the vCPU registers.
    '';
    license = with licenses; [ gpl3 lgpl3 ];
    maintainers = with maintainers; [ lschuermann ];
  };
}


{ lib
, buildPythonPackage
, fetchFromGitHub
, pytestCheckHook
, pytest-asyncio
}:

buildPythonPackage rec {
  pname = "sanic-routing";
  version = "21.12.0";

  src = fetchFromGitHub {
    owner = "sanic-org";
    repo = "sanic-routing";
    rev = "v${version}";
    hash = "sha256-IN+keJ5OI++p33/FgW5Xo+Pk09VuR7EASDF7G6eWvM4=";
  };

  checkInputs = [ pytestCheckHook pytest-asyncio ];
  pythonImportsCheck = [ "sanic_routing" ];

  meta = with lib; {
    description = "Core routing component for the Sanic web framework";
    homepage = "https://github.com/sanic-org/sanic-routing";
    license = licenses.mit;
    maintainers = with maintainers; [ AluisioASG ];
  };
}

Revert "python3Packages.sanic-routing: 0.7.2 -> 21.12.0"

{ lib
, buildPythonPackage
, fetchFromGitHub
, pytestCheckHook
, pytest-asyncio
}:

buildPythonPackage rec {
  pname = "sanic-routing";
  version = "0.7.2";

  src = fetchFromGitHub {
    owner = "sanic-org";
    repo = "sanic-routing";
    rev = "v${version}";
    hash = "sha256-MN6A8CtDVxj34eehr3UIwCT09VOfcruVX+/iImr1MgY=";
  };

  checkInputs = [ pytestCheckHook pytest-asyncio ];
  pythonImportsCheck = [ "sanic_routing" ];

  meta = with lib; {
    description = "Core routing component for the Sanic web framework";
    homepage = "https://github.com/sanic-org/sanic-routing";
    license = licenses.mit;
    maintainers = with maintainers; [ AluisioASG ];
  };
}


{ lib
, stdenv
, fetchFromGitHub
}:

stdenv.mkDerivation rec {
  pname = "oed";
  version = "6.7";

  src = fetchFromGitHub {
    owner = "ibara";
    repo = "oed";
    rev = "oed-${version}";
    hash = "sha256-Z8B1RIFve3UPj+9G/WJX0BNc2ynG/qtoGfoesarYGz8=";
  };

  meta = with lib; {
    homepage = "https://github.com/ibara/oed";
    description = "Portable ed editor from OpenBSD";
    license = with licenses; [ bsd2 ];
    maintainers = with maintainers; [ AndersonTorres ];
    platforms = platforms.unix;
  };
}

Remove myself from oed maintainers list

{ lib
, stdenv
, fetchFromGitHub
}:

stdenv.mkDerivation rec {
  pname = "oed";
  version = "6.7";

  src = fetchFromGitHub {
    owner = "ibara";
    repo = "oed";
    rev = "oed-${version}";
    hash = "sha256-Z8B1RIFve3UPj+9G/WJX0BNc2ynG/qtoGfoesarYGz8=";
  };

  meta = with lib; {
    homepage = "https://github.com/ibara/oed";
    description = "Portable ed editor from OpenBSD";
    license = with licenses; [ bsd2 ];
    platforms = platforms.unix;
  };
}


{stdenv, fetchurl, SDL, mesa, rebar, erlang, opencl-headers, ocl-icd }:

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

  src = fetchurl {
    url = "https://github.com/tonyrog/cl/archive/${name}.tar.gz";
    sha256 = "03jv280h9gqqqkm0mmkjr53srd2mzhvyy1biss77wpjrzq2z12c8";
  };

  buildInputs = [ erlang rebar opencl-headers ocl-icd ];
  #propagatedBuildInputs = [ SDL mesa ];

  buildPhase = ''
    sed 's/git/"${version}"/' -i src/cl.app.src
    rebar compile
  '';

  # 'cp' line taken from Arch recipe
  # https://projects.archlinux.org/svntogit/community.git/tree/trunk/PKGBUILD?h=packages/erlang-sdl
  installPhase = ''
    DIR=$out/lib/erlang/lib/${name}
    mkdir -p $DIR
    cp -ruv c_src doc ebin include priv src $DIR
  '';

  meta = {
    homepage = https://github.com/tonyrog/cl;
    description = "OpenCL binding for Erlang";
    license = stdenv.lib.licences.mit;
  };
}

Fix evaluation. (licenses, not licences)

{stdenv, fetchurl, SDL, mesa, rebar, erlang, opencl-headers, ocl-icd }:

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

  src = fetchurl {
    url = "https://github.com/tonyrog/cl/archive/${name}.tar.gz";
    sha256 = "03jv280h9gqqqkm0mmkjr53srd2mzhvyy1biss77wpjrzq2z12c8";
  };

  buildInputs = [ erlang rebar opencl-headers ocl-icd ];
  #propagatedBuildInputs = [ SDL mesa ];

  buildPhase = ''
    sed 's/git/"${version}"/' -i src/cl.app.src
    rebar compile
  '';

  # 'cp' line taken from Arch recipe
  # https://projects.archlinux.org/svntogit/community.git/tree/trunk/PKGBUILD?h=packages/erlang-sdl
  installPhase = ''
    DIR=$out/lib/erlang/lib/${name}
    mkdir -p $DIR
    cp -ruv c_src doc ebin include priv src $DIR
  '';

  meta = {
    homepage = https://github.com/tonyrog/cl;
    description = "OpenCL binding for Erlang";
    license = stdenv.lib.licenses.mit;
  };
}


{ stdenv, fetchFromGitHub }:

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

  src = fetchFromGitHub {
    owner = "silentbicycle";
    repo = "theft";
    rev = "v${version}";
    sha256 = "1ibh8np12lafnrsrvjbbzlyq45zq654939x0y22vdnc6s8dpbhw4";
  };

  preConfigure = "patchShebangs ./scripts/mk_bits_lut";

  doCheck = true;
  checkTarget = "test";

  installFlags = [ "PREFIX=$(out)" ];
  postInstall = ''
      install -m644 vendor/greatest.h $out/include/
    '';

  meta = {
    description = "A C library for property-based testing.";
    platforms = stdenv.lib.platforms.linux;
    homepage = "http://github.com/silentbicycle/theft/";
    license = stdenv.lib.licenses.isc;
    maintainers = [ stdenv.lib.maintainers.kquick ];
  };
}

Remove trailing period from description per contribution guidelines.

{ stdenv, fetchFromGitHub }:

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

  src = fetchFromGitHub {
    owner = "silentbicycle";
    repo = "theft";
    rev = "v${version}";
    sha256 = "1ibh8np12lafnrsrvjbbzlyq45zq654939x0y22vdnc6s8dpbhw4";
  };

  preConfigure = "patchShebangs ./scripts/mk_bits_lut";

  doCheck = true;
  checkTarget = "test";

  installFlags = [ "PREFIX=$(out)" ];
  postInstall = ''
      install -m644 vendor/greatest.h $out/include/
    '';

  meta = {
    description = "A C library for property-based testing";
    platforms = stdenv.lib.platforms.linux;
    homepage = "http://github.com/silentbicycle/theft/";
    license = stdenv.lib.licenses.isc;
    maintainers = [ stdenv.lib.maintainers.kquick ];
  };
}


{ cabal, base64Bytestring, cprngAes, dataDefault, filepath
, mimeMail, network, stringsearch, text, tls
}:

cabal.mkDerivation (self: {
  pname = "smtps-gmail";
  version = "1.1.0";
  sha256 = "0zr2ndpwfnb9pkv69vx94p0vpghl0khd0wbmccjpk6hlrp6fsj66";
  buildDepends = [
    base64Bytestring cprngAes dataDefault filepath mimeMail network
    stringsearch text tls
  ];
  meta = {
    homepage = "https://github.com/enzoh/smtps-gmail";
    description = "Gmail SMTP Client";
    license = self.stdenv.lib.licenses.bsd3;
    platforms = self.ghc.meta.platforms;
  };
})

Revert "haskell-smtps-gmail: update to version 1.1.0"

{ cabal, base64String, cprngAes, network, tlsExtra, utf8String
}:

cabal.mkDerivation (self: {
  pname = "smtps-gmail";
  version = "1.0.0";
  sha256 = "0kv5m8rg5z1iic10av3bscdygnph1iab4b22sq3hmx6a93abqkc2";
  isLibrary = true;
  isExecutable = true;
  buildDepends = [
    base64String cprngAes network tlsExtra utf8String
  ];
  meta = {
    homepage = "https://github.com/enzoh/smtps-gmail";
    description = "Gmail API";
    license = self.stdenv.lib.licenses.bsd3;
    platforms = self.ghc.meta.platforms;
  };
  # adding a Setup script as it's needed by nix
  preConfigure = ''
    printf "import Distribution.Simple\nmain = defaultMain\n" > Setup.hs
  '';
})


{ config, stdenv, pkgs, callPackage, target-os,
  gradle, status-go, composeXcodeWrapper, nodejs }:

with stdenv;

let
  platform = callPackage ../platform.nix { inherit target-os; };
  xcodewrapperArgs = {
    version = "10.1";
  };
  xcodeWrapper = composeXcodeWrapper xcodewrapperArgs;
  androidPlatform = callPackage ./android.nix { inherit config gradle; };
  selectedSources =
    [ status-go ] ++
    lib.optional platform.targetAndroid androidPlatform;

in
  {
    inherit (androidPlatform) androidComposition;
    inherit xcodewrapperArgs;

    buildInputs =
      status-go.buildInputs ++
      lib.catAttrs "buildInputs" selectedSources ++
      lib.optional (platform.targetIOS && isDarwin) xcodeWrapper;
    shellHook = lib.concatStrings (lib.catAttrs "shellHook" selectedSources);
  }

Upgrade Xcode requirement to 10.2.1

{ config, stdenv, pkgs, callPackage, target-os,
  gradle, status-go, composeXcodeWrapper, nodejs }:

with stdenv;

let
  platform = callPackage ../platform.nix { inherit target-os; };
  xcodewrapperArgs = {
    version = "10.2.1";
  };
  xcodeWrapper = composeXcodeWrapper xcodewrapperArgs;
  androidPlatform = callPackage ./android.nix { inherit config gradle; };
  selectedSources =
    [ status-go ] ++
    lib.optional platform.targetAndroid androidPlatform;

in
  {
    inherit (androidPlatform) androidComposition;
    inherit xcodewrapperArgs;

    buildInputs =
      status-go.buildInputs ++
      lib.catAttrs "buildInputs" selectedSources ++
      lib.optional (platform.targetIOS && isDarwin) xcodeWrapper;
    shellHook = lib.concatStrings (lib.catAttrs "shellHook" selectedSources);
  }


{ stdenv, fetchurl, readline ? null, ncurses ? null }:

assert readline != null -> ncurses != null;

stdenv.mkDerivation {
  name = "sqlite-3.7.9";

  src = fetchurl {
    url = http://www.sqlite.org/sqlite-autoconf-3070900.tar.gz;
    sha1 = "a9da98a4bde4d9dae5c29a969455d11a03600e11";
  };

  buildInputs = [ readline ncurses ];

  configureFlags = "--enable-threadsafe";

  NIX_CFLAGS_COMPILE = "-DSQLITE_ENABLE_COLUMN_METADATA=1 -DSQLITE_SECURE_DELETE=1 -DSQLITE_ENABLE_UNLOCK_NOTIFY=1";
  NIX_CFLAGS_LINK = if readline != null then "-lncurses" else "";

  meta = {
    homepage = http://www.sqlite.org/;
    description = "A self-contained, serverless, zero-configuration, transactional SQL database engine";
  };
}

Use {C,LD}FLAGS instead of NIX_CFLAGS_*

{ stdenv, fetchurl, readline ? null, ncurses ? null }:

assert readline != null -> ncurses != null;

stdenv.mkDerivation {
  name = "sqlite-3.7.9";

  src = fetchurl {
    url = http://www.sqlite.org/sqlite-autoconf-3070900.tar.gz;
    sha1 = "a9da98a4bde4d9dae5c29a969455d11a03600e11";
  };

  buildInputs = [ readline ncurses ];

  configureFlags = "--enable-threadsafe";

  CFLAGS = "-DSQLITE_ENABLE_COLUMN_METADATA=1 -DSQLITE_SECURE_DELETE=1 -DSQLITE_ENABLE_UNLOCK_NOTIFY=1";
  LDFLAGS = if readline != null then "-lncurses" else "";

  meta = {
    homepage = http://www.sqlite.org/;
    description = "A self-contained, serverless, zero-configuration, transactional SQL database engine";
  };
}


{ stdenv, fetchurl, pkgconfig, systemd
, boost, libsodium, libedit, re2
, net_snmp, lua, protobuf, openssl }: stdenv.mkDerivation rec {
  name = "dnsdist-${version}";
  version = "1.3.0";

  src = fetchurl {
    url = "https://downloads.powerdns.com/releases/dnsdist-${version}.tar.bz2";
    sha256 = "025sgvpi3ps0n4mzfwkk6a5ang90a3c7s2fi9vni6jj0p16wsrxa";
  };

  nativeBuildInputs = [ pkgconfig ];
  buildInputs = [ systemd boost libsodium libedit re2 net_snmp lua protobuf openssl ];

  configureFlags = [
    "--enable-libsodium"
    "--enable-re2"
    "--enable-dnscrypt"
    "--enable-dns-over-tls"
    "--with-protobuf=yes"
    "--with-net-snmp"
    "--disable-dependency-tracking"
    "--enable-unit-tests"
    "--enable-systemd"
  ];

  doCheck = true;

  meta = with stdenv.lib; {
    description = "DNS Loadbalancer";
    homepage = "https://dnsdist.org";
    license = licenses.gpl2;
  };
}

Add myself as maintainer for dnsdist

{ stdenv, fetchurl, pkgconfig, systemd
, boost, libsodium, libedit, re2
, net_snmp, lua, protobuf, openssl }: stdenv.mkDerivation rec {
  name = "dnsdist-${version}";
  version = "1.3.0";

  src = fetchurl {
    url = "https://downloads.powerdns.com/releases/dnsdist-${version}.tar.bz2";
    sha256 = "025sgvpi3ps0n4mzfwkk6a5ang90a3c7s2fi9vni6jj0p16wsrxa";
  };

  nativeBuildInputs = [ pkgconfig ];
  buildInputs = [ systemd boost libsodium libedit re2 net_snmp lua protobuf openssl ];

  configureFlags = [
    "--enable-libsodium"
    "--enable-re2"
    "--enable-dnscrypt"
    "--enable-dns-over-tls"
    "--with-protobuf=yes"
    "--with-net-snmp"
    "--disable-dependency-tracking"
    "--enable-unit-tests"
    "--enable-systemd"
  ];

  doCheck = true;

  meta = with stdenv.lib; {
    description = "DNS Loadbalancer";
    homepage = "https://dnsdist.org";
    license = licenses.gpl2;
    maintainers = with maintainers; [ das_j ];
  };
}


{stdenv, fetchurl}:

stdenv.mkDerivation rec {
  name = "iwlwifi-4965-ucode-4.44.17";

  src = fetchurl {
    url = "http://intellinuxwireless.org/iwlwifi/downloads/" + name + ".tgz";
    sha256 = "1mfnxsp58jvh0njvwaxrkbiggbzr4jd0hk314hxfwyjpjdd2hj6w";
  };

  buildPhase = "true";

  installPhase = "ensureDir $out; chmod -x *; cp * $out";

  meta = {
    description = "Firmware for the Intel 4965ABG wireless card";
    homepage = http://intellinuxwireless.org/;
  };
}

Fix the iwl4965 firmware (Intel Wi-Fi).

{stdenv, fetchurl}:

stdenv.mkDerivation rec {
  name = "iwlwifi-4965-ucode-4.44.17";

  src = fetchurl {
    url = "http://intellinuxwireless.org/iwlwifi/downloads/" + name + ".tgz";
    sha256 = "1mfnxsp58jvh0njvwaxrkbiggbzr4jd0hk314hxfwyjpjdd2hj6w";
  };

  buildPhase = "true";

  installPhase = ''
    ensureDir "$out"
    chmod -x *
    cp * "$out"

    # The driver expects the `-1' in the file name.
    cd "$out"
    ln -s iwlwifi-4965.ucode iwlwifi-4965-1.ucode
  '';

  meta = {
    description = "Firmware for the Intel 4965ABG wireless card";
    homepage = http://intellinuxwireless.org/;
  };
}


{ stdenv, fetchurl, pythonPackages, mopidy }:

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

  version = "0.3.1";

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

  propagatedBuildInputs = [ mopidy ];

  doCheck = false;

  meta = with stdenv.lib; {
    homepage = https://github.com/martijnboland/moped;
    description = "A web client for Mopidy";
    license = licenses.mit;
    maintainers = [ maintainers.rickynils ];
    hydraPlatforms = [];
  };
}

Update from 0.3.1 to 0.3.3

{ stdenv, fetchurl, pythonPackages, mopidy }:

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

  version = "0.3.3";

  src = fetchurl {
    url = "https://github.com/martijnboland/moped/archive/v${version}.tar.gz";
    sha256 = "19f3asqx7wmla53nhrxzdwj6qlkjv2rcwh34jxp27bz7nkhn0ihv";
  };

  propagatedBuildInputs = [ mopidy ];

  doCheck = false;

  meta = with stdenv.lib; {
    homepage = https://github.com/martijnboland/moped;
    description = "A web client for Mopidy";
    license = licenses.mit;
    maintainers = [ maintainers.rickynils ];
    hydraPlatforms = [];
  };
}


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

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

  src = fetchFromGitHub {
    owner = "zfsonlinux";
    repo = "zfs";
    rev = "zfs-${version}";
    sha256 = "0xlj2w6gadip3rr3f1lri1n93lkjpzyksnk01sbl5wsrbkry3xjq";
  };

  patches = [ ./nix-build.patch ];
})

Update from 0.6.4 -> 0.6.4.1

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

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

  src = fetchFromGitHub {
    owner = "zfsonlinux";
    repo = "zfs";
    rev = "zfs-${version}";
    sha256 = "15fh1b2rvzvx4j3vgkwrgy2sd553bzwcvk1zai6phjhb6i2rw8v4";
  };

  patches = [ ./nix-build.patch ];
})


x@{builderDefsPackage
  (abort "Specify dependencies")
  , ...}:
builderDefsPackage
(a :
let
  s = import ./src-for-default.nix;
  helperArgNames = ["stdenv" "fetchurl" "builderDefsPackage"] ++
    [(abort "Specify helper argument names")];
  buildInputs = map (n: builtins.getAttr n x)
    (builtins.attrNames (builtins.removeAttrs x helperArgNames));
in
rec {
  src = a.fetchUrlFromSrcInfo s;

  inherit (s) name;
  inherit buildInputs;

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

  meta = {
    description = "${abort ''Specify description''}";
    maintainers = with a.lib.maintainers;
    [
      (abort "Specify maintainers")
    ];
    platforms = with a.lib.platforms;
      (abort "Specify platforms");
  };
}) x

Update the currently used autocallable template to make it usable with probable future autoupdater..

x@{builderDefsPackage
  (abort "Specify dependencies")
  , ...}:
builderDefsPackage
(a :
let
  helperArgNames = ["stdenv" "fetchurl" "builderDefsPackage"] ++
    [(abort "Specify helper argument names")];

  buildInputs = map (n: builtins.getAttr n x)
    (builtins.attrNames (builtins.removeAttrs x helperArgNames));
  sourceInfo = {
  };
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 = "${abort ''Specify description''}";
    maintainers = with a.lib.maintainers;
    [
      (abort "Specify maintainers")
    ];
    platforms = with a.lib.platforms;
      (abort "Specify platforms");
  };
  passthru = {
    updateInfo = {
      downloadPage = "${abort ''Specify download page''}";
    };
  };
}) x


{ pkgs, fetchurl, buildPythonPackage, sqlite3 }:

buildPythonPackage rec {
  version = "6.5.6";
  name = "offlineimap-${version}";
  namePrefix = "";

  src = fetchurl {
    url = "https://github.com/OfflineIMAP/offlineimap/archive/v${version}.tar.gz";
    sha256 = "1hr8yxb6r8lmdzzly4hafa1l1z9pfx14rsgc8qiy2zxfpg6ijcn2";
  };

  doCheck = false;

  propagatedBuildInputs = [
    sqlite3
  ];

  meta = {
    description = "Synchronize emails between two repositories, so that you can read the same mailbox from multiple computers";
    homepage = "http://offlineimap.org";
    license = pkgs.lib.licenses.gpl2Plus;
    maintainers = [ pkgs.lib.maintainers.garbas ];
  };
}

Update offlineimap 6.5.6 -> 6.5.7

{ pkgs, fetchurl, buildPythonPackage, sqlite3 }:

buildPythonPackage rec {
  version = "6.5.7";
  name = "offlineimap-${version}";
  namePrefix = "";

  src = fetchurl {
    url = "https://github.com/OfflineIMAP/offlineimap/archive/v${version}.tar.gz";
    sha256 = "18whwc4f8nk8gi3mjw9153c9cvwd3i9i7njmpdbhcplrv33m5pmp";
  };

  doCheck = false;

  propagatedBuildInputs = [
    sqlite3
  ];

  meta = {
    description = "Synchronize emails between two repositories, so that you can read the same mailbox from multiple computers";
    homepage = "http://offlineimap.org";
    license = pkgs.lib.licenses.gpl2Plus;
    maintainers = [ pkgs.lib.maintainers.garbas ];
  };
}


with (import ((import ../lib.nix).fetchNixPkgs) {});

stdenv.mkDerivation {
  name = "daedalus-bridge";

  buildInputs = [ nodejs-7_x nodePackages.bower purescript ];

  src = null;
}

Use older nixpkgs for PureScript 0.10.7

with (import (fetchTarball https://github.com/NixOS/nixpkgs/archive/8bed8fb53227932886ab23e5f5f9eabe139f8e9f.tar.gz) {});
# TODO: upgrade to purescript 0.11.5
#with (import ((import ../lib.nix).fetchNixPkgs) {});

stdenv.mkDerivation {
  name = "daedalus-bridge";

  buildInputs = [ nodejs-7_x nodePackages.bower purescript ];

  src = null;
}


{ stdenv, fetchurl, flex, cracklib, libxcrypt }:

stdenv.mkDerivation {
  name = "linux-pam-1.1.1";

  src = fetchurl {
    url = mirror://kernel/linux/libs/pam/library/Linux-PAM-1.1.1.tar.bz2;
    sha256 = "015r3xdkjpqwcv4lvxavq0nybdpxhfjycqpzbx8agqd5sywkx3b0";
  };

  buildNativeInputs = [ flex ];
  buildInputs = [ cracklib ]
    ++ stdenv.lib.optional
      (stdenv.system != "armv5tel-linux" && stdenv.system != "mips64-linux")
      libxcrypt;

  crossAttrs = {
    # Skip libxcrypt cross-building, as it fails for mips and armv5tel
    propagatedBuildInputs = [ flex.hostDrv cracklib.hostDrv ];
  };

  postInstall = ''
    mv -v $out/sbin/unix_chkpwd{,.orig}
    ln -sv /var/setuid-wrappers/unix_chkpwd $out/sbin/unix_chkpwd
    '';

  preConfigure = ''
    configureFlags="$configureFlags --includedir=$out/include/security"
  '';

  meta = {
    homepage = http://ftp.kernel.org/pub/linux/libs/pam/;
    description = "Pluggable Authentication Modules, a flexible mechanism for authenticating user";
    platforms = stdenv.lib.platforms.linux;
  };
}

Fix one part of cross-Linux-PAM failure...

{ stdenv, fetchurl, flex, cracklib, libxcrypt }:

stdenv.mkDerivation {
  name = "linux-pam-1.1.1";

  src = fetchurl {
    url = mirror://kernel/linux/libs/pam/library/Linux-PAM-1.1.1.tar.bz2;
    sha256 = "015r3xdkjpqwcv4lvxavq0nybdpxhfjycqpzbx8agqd5sywkx3b0";
  };

  buildNativeInputs = [ flex ];
  buildInputs = [ cracklib ]
    ++ stdenv.lib.optional
      (stdenv.system != "armv5tel-linux" && stdenv.system != "mips64-linux")
      libxcrypt;

  crossAttrs = {
    # Skip libxcrypt cross-building, as it fails for mips and armv5tel
    propagatedBuildInputs = [ flex.hostDrv cracklib.hostDrv ];
    preConfigure = ''
      ar x ${flex.hostDrv}/lib/libfl.a
      export LDFLAGS="$LDFLAGS $PWD/libyywrap.o"
    '';
  };

  postInstall = ''
    mv -v $out/sbin/unix_chkpwd{,.orig}
    ln -sv /var/setuid-wrappers/unix_chkpwd $out/sbin/unix_chkpwd
    '';

  preConfigure = ''
    configureFlags="$configureFlags --includedir=$out/include/security"
  '';

  meta = {
    homepage = http://ftp.kernel.org/pub/linux/libs/pam/;
    description = "Pluggable Authentication Modules, a flexible mechanism for authenticating user";
    platforms = stdenv.lib.platforms.linux;
  };
}


{ stdenv, fetchgit
, sqlite, expat, mp4v2, flac, spidermonkey_68, taglib, libexif, curl, ffmpeg_3, file
, pkgconfig, autoreconfHook }:

stdenv.mkDerivation rec {
  pname = "mediatomb";
  version = "0.12.1";

  src = fetchgit {
    url = meta.repositories.git;
    rev = "7ab761696354868bd5d67ff4f2d849994e4c98e2";
    sha256 = "1mimslr4q6mky865y6561rr64cbn4gf0qc2dhgb31hxp4rc1kmzd";
  };

  buildInputs = [ sqlite expat spidermonkey_68 taglib libexif curl ffmpeg_3 file mp4v2 flac
                  pkgconfig autoreconfHook ];

  meta = with stdenv.lib; {
    homepage = "http://mediatomb.cc";
    repositories.git = "git://mediatomb.git.sourceforge.net/gitroot/mediatomb/mediatomb";
    description = "UPnP MediaServer with a web user interface";
    license = licenses.gpl2;
    maintainers = [ maintainers.phreedom ];
    platforms = platforms.linux;
  };
}

Revert "treewide: Use spidermonkey_68 explicitly"

{ stdenv, fetchgit
, sqlite, expat, mp4v2, flac, spidermonkey, taglib, libexif, curl, ffmpeg_3, file
, pkgconfig, autoreconfHook }:

stdenv.mkDerivation rec {
  pname = "mediatomb";
  version = "0.12.1";

  src = fetchgit {
    url = meta.repositories.git;
    rev = "7ab761696354868bd5d67ff4f2d849994e4c98e2";
    sha256 = "1mimslr4q6mky865y6561rr64cbn4gf0qc2dhgb31hxp4rc1kmzd";
  };

  buildInputs = [ sqlite expat spidermonkey taglib libexif curl ffmpeg_3 file mp4v2 flac
                  pkgconfig autoreconfHook ];

  meta = with stdenv.lib; {
    homepage = "http://mediatomb.cc";
    repositories.git = "git://mediatomb.git.sourceforge.net/gitroot/mediatomb/mediatomb";
    description = "UPnP MediaServer with a web user interface";
    license = licenses.gpl2;
    maintainers = [ maintainers.phreedom ];
    platforms = platforms.linux;
  };
}


{ lib, ... }:
{
  nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
    "1password"
    "dropbox"
    "nvidia-settings"
    "nvidia-x11"
    "onepassword-password-manager"
    "skypeforlinux"
    "slack"
    "spotify"
    "spotify-unwrapped"
    "vscode"
    "vscode-with-extensions"
    "zoom"
  ];
}

Add 1password-cli to allowUnfree predicate

{ lib, ... }:
{
  nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
    "1password"
    "1password-cli"
    "dropbox"
    "nvidia-settings"
    "nvidia-x11"
    "onepassword-password-manager"
    "skypeforlinux"
    "slack"
    "spotify"
    "spotify-unwrapped"
    "vscode"
    "vscode-with-extensions"
    "zoom"
  ];
}


{ stdenv, fetchurl, alsaLib, glib, jackaudio, libsndfile, pkgconfig
, pulseaudio, cmake }:

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

  src = fetchurl {
    url = "mirror://sourceforge/fluidsynth/${name}.tar.bz2";
    sha256 = "00gn93bx4cz9bfwf3a8xyj2by7w23nca4zxf09ll53kzpzglg2yj";
  };

  preBuild = stdenv.lib.optionalString stdenv.isDarwin ''
    sed -i '40 i\
    #include <CoreAudio/AudioHardware.h>\
    #include <CoreAudio/AudioHardwareDeprecated.h>' \
    src/drivers/fluid_coreaudio.c
  '';

  NIX_LDFLAGS = stdenv.lib.optionalString stdenv.isDarwin
    "-framework CoreAudio";

  buildInputs = [ cmake glib libsndfile pkgconfig ]
    ++ stdenv.lib.optionals (!stdenv.isDarwin) [ alsaLib pulseaudio jackaudio ];

  meta = with stdenv.lib; {
    description = "Real-time software synthesizer based on the SoundFont 2 specifications";
    homepage    = http://www.fluidsynth.org;
    license     = licenses.lgpl2;
    maintainers = with maintainers; [ goibhniu lovek323 ];
    platforms   = platforms.unix;
  };
}

Revert "fluidsynth: switch to cmake build system" which causes mpd and calf to fail to detect fluidsynth.

{ stdenv, fetchurl, alsaLib, glib, jackaudio, libsndfile, pkgconfig
, pulseaudio }:

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

  src = fetchurl {
    url = "mirror://sourceforge/fluidsynth/${name}.tar.bz2";
    sha256 = "00gn93bx4cz9bfwf3a8xyj2by7w23nca4zxf09ll53kzpzglg2yj";
  };

  preBuild = stdenv.lib.optionalString stdenv.isDarwin ''
    sed -i '40 i\
    #include <CoreAudio/AudioHardware.h>\
    #include <CoreAudio/AudioHardwareDeprecated.h>' \
    src/drivers/fluid_coreaudio.c
  '';

  NIX_LDFLAGS = stdenv.lib.optionalString stdenv.isDarwin
    "-framework CoreAudio";

  buildInputs = [ glib libsndfile pkgconfig ]
    ++ stdenv.lib.optionals (!stdenv.isDarwin) [ alsaLib pulseaudio jackaudio ];

  meta = with stdenv.lib; {
    description = "Real-time software synthesizer based on the SoundFont 2 specifications";
    homepage    = http://www.fluidsynth.org;
    license     = licenses.lgpl2;
    maintainers = with maintainers; [ goibhniu lovek323 ];
    platforms   = platforms.unix;
  };
}


{ haskellLib, fetchFromGitHub, lib }:

self: super: {
  mkDerivation = attrs: let
    drv = (super.mkDerivation (attrs // {
      preConfigure = ''
        ${attrs.preConfigure or ""}
        configureFlags+=" --ghc-option=-save-splices=$out$SPLICE_DIR"
      '';
    }));

    SPLICE_DIR = "/lib/${drv.compiler.name}/${drv.name}";

    # Not all packages can be spliced with our patched ghc.
    shouldSplice = !(builtins.elem attrs.pname [
      "math-functions" "generic-deriving" "dependent-sum-template"
    ]);

  in if shouldSplice
     then ((drv.overrideAttrs (_: { inherit SPLICE_DIR; }))
          // { inherit SPLICE_DIR; })
     else super.mkDerivation attrs;

  haddock = super.haddock.overrideAttrs (drv: {
    patches = (drv.patches or []) ++ [ ./haddock.patch ];
  });

  vector-th-unbox = haskellLib.dontCheck super.vector-th-unbox;
  lens = haskellLib.dontCheck super.lens;

  # Can’t build it outside of android. Hopefully no one wants to use
  # template haskell with it.
  android-activity = null;

  # Disable wkwebview. It doesn’t evaluate natively somehow.
  jsaddle-wkwebview = null;
}

Revert "Revert "Fix iosReflexTodomvc eval""

{ haskellLib, fetchFromGitHub, lib }:

self: super: {
  mkDerivation = attrs: let
    drv = (super.mkDerivation (attrs // {
      preConfigure = ''
        ${attrs.preConfigure or ""}
        configureFlags+=" --ghc-option=-save-splices=$out$SPLICE_DIR"
      '';
    }));

    SPLICE_DIR = "/lib/${drv.compiler.name}/${drv.name}";

    # Not all packages can be spliced with our patched ghc.
    shouldSplice = !(builtins.elem attrs.pname [
      "math-functions" "generic-deriving" "dependent-sum-template"
    ]);

  in if shouldSplice
     then ((drv.overrideAttrs (_: { inherit SPLICE_DIR; }))
          // { inherit SPLICE_DIR; })
     else super.mkDerivation attrs;

  haddock = super.haddock.overrideAttrs (drv: {
    patches = (drv.patches or []) ++ [ ./haddock.patch ];
  });

  vector-th-unbox = haskellLib.dontCheck super.vector-th-unbox;
  lens = haskellLib.dontCheck super.lens;

  # Can’t build it outside of android. Hopefully no one wants to use
  # template haskell with it.
  android-activity = null;
}


# This function downloads and unpacks an archive file, such as a zip
# or tar file. This is primarily useful for dynamically generated
# archives, such as GitHub's /archive URLs, where the unpacked content
# of the zip file doesn't change, but the zip file itself may
# (e.g. due to minor changes in the compression algorithm, or changes
# in timestamps).

{ lib, fetchurl, unzip }:

{ # Optionally move the contents of the unpacked tree up one level.
  stripRoot ? true
, url
, ... } @ args:

fetchurl ({
  name = args.name or (baseNameOf url);

  recursiveHash = true;

  downloadToTemp = true;

  postFetch =
    ''
      export PATH=${unzip}/bin:$PATH
      mkdir $out
      cd $out
      renamed="$TMPDIR/${baseNameOf url}"
      mv "$downloadedFile" "$renamed"
      unpackFile "$renamed"
    ''
    # FIXME: handle zip files that contain a single regular file.
    + lib.optionalString stripRoot ''
      shopt -s dotglob
      if [ "$(ls -d $out/* | wc -l)" != 1 ]; then
        echo "error: zip file must contain a single directory."
        exit 1
      fi
      fn=$(cd "$out" && echo *)
      mv $out/$fn/* "$out/"
      rmdir "$out/$fn"
    '';
} // args)

Fix fetchzip for actuall zip files

# This function downloads and unpacks an archive file, such as a zip
# or tar file. This is primarily useful for dynamically generated
# archives, such as GitHub's /archive URLs, where the unpacked content
# of the zip file doesn't change, but the zip file itself may
# (e.g. due to minor changes in the compression algorithm, or changes
# in timestamps).

{ lib, fetchurl, unzip }:

{ # Optionally move the contents of the unpacked tree up one level.
  stripRoot ? true
, url
, ... } @ args:

lib.overrideDerivation (fetchurl ({
  name = args.name or (baseNameOf url);

  recursiveHash = true;

  downloadToTemp = true;

  postFetch =
    ''
      export PATH=${unzip}/bin:$PATH
      mkdir $out
      cd $out
      renamed="$TMPDIR/${baseNameOf url}"
      mv "$downloadedFile" "$renamed"
      unpackFile "$renamed"
    ''
    # FIXME: handle zip files that contain a single regular file.
    + lib.optionalString stripRoot ''
      shopt -s dotglob
      if [ "$(ls -d $out/* | wc -l)" != 1 ]; then
        echo "error: zip file must contain a single directory."
        exit 1
      fi
      fn=$(cd "$out" && echo *)
      mv $out/$fn/* "$out/"
      rmdir "$out/$fn"
    '';
} // args))
# Hackety-hack: we actually need unzip hooks, too
(x: {nativeBuildInputs = x.nativeBuildInputs++ [unzip];})


{stdenv, buildOcamlJane,
 ppx_core, ppx_tools, ppx_type_conv, sexplib}:

buildOcamlJane rec {
  name = "ppx_sexp_conv";
  hash = "1kgbmlc11w5jhbhmy5n0f734l44zwyry48342dm5qydi9sfzcgq2";
  propagatedBuildInputs = [ ppx_core ppx_tools ppx_type_conv sexplib];

  meta = with stdenv.lib; {
    description = "A ppx rewriter that defines an extension node whose value is its source position";
    maintainers = [ maintainers.maurer ];
    license = licenses.asl20;
  };
}

Fix description to match package

{stdenv, buildOcamlJane,
 ppx_core, ppx_tools, ppx_type_conv, sexplib}:

buildOcamlJane rec {
  name = "ppx_sexp_conv";
  hash = "1kgbmlc11w5jhbhmy5n0f734l44zwyry48342dm5qydi9sfzcgq2";
  propagatedBuildInputs = [ ppx_core ppx_tools ppx_type_conv sexplib];

  meta = with stdenv.lib; {
    description = "PPX syntax extension that generates code for converting OCaml types to and from s-expressions, as defined in the sexplib library";
    maintainers = [ maintainers.maurer ];
    license = licenses.asl20;
  };
}


{stdenv, fetchurl, openssl, ncurses, pkgconfig, glib, loudmouth, libotr}:

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

  src = fetchurl {
    url = "http://mcabber.com/files/mcabber-${version}.tar.bz2";
    sha256 = "0vgsqw6yn0lzzcnr4fql4ycgf3gwqj6w4p0l4nqnvhkc94w62ikp";
  };

  buildInputs = [openssl ncurses pkgconfig glib loudmouth libotr];

  configureFlags = "--with-openssl=${openssl} --enable-modules --enable-otr";

  meta = with stdenv.lib; {
    homepage = http://mcabber.com/;
    description = "Small Jabber console client";
    license = licenses.gpl2;
    maintainers = with maintainers; [ pSub ];
  };
}

Build with support for GPG.

{ stdenv, fetchurl, openssl, ncurses, pkgconfig, glib, loudmouth, libotr
, gpgme
}:

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

  src = fetchurl {
    url = "http://mcabber.com/files/mcabber-${version}.tar.bz2";
    sha256 = "0vgsqw6yn0lzzcnr4fql4ycgf3gwqj6w4p0l4nqnvhkc94w62ikp";
  };

  buildInputs = [ openssl ncurses pkgconfig glib loudmouth libotr gpgme ];

  configureFlags = "--with-openssl=${openssl} --enable-modules --enable-otr";

  meta = with stdenv.lib; {
    homepage = http://mcabber.com/;
    description = "Small Jabber console client";
    license = licenses.gpl2;
    maintainers = with maintainers; [ pSub ];
  };
}


{ stdenv, fetchurl, which, m4, python
, protobuf, boost, zlib, curl, openssl, icu, jemalloc
}:

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

  src = fetchurl {
    url = "http://download.rethinkdb.com/dist/${name}.tgz";
    sha256 = "19qhia4lfa8a0rzp2v6lnlxp2lf4z4vqhgfxnicfdnx07q4r847i";
  };

  postPatch = ''
    # Remove the dependence on bundled libraries
    sed -i '/must_fetch_list/ s/ v8//' configure

    # Don't use the default command line args
    rm configure.default
  '';

  preConfigure = ''
    export ALLOW_WARNINGS=1
    patchShebangs .
  '';

  configureFlags = [
    "--dynamic=all"
    "--with-jemalloc"
    "--lib-path=${jemalloc}/lib"
  ];

  buildInputs = [ protobuf boost zlib curl openssl icu jemalloc ];

  nativeBuildInputs = [ which m4 python ];

  enableParallelBuilding = true;

  meta = {
    description = "An open-source distributed database built with love";
    longDescription = ''
      RethinkDB is built to store JSON documents, and scale to multiple machines with very little
      effort. It has a pleasant query language that supports really useful queries like table joins
      and group by, and is easy to setup and learn.
    '';
    homepage = http://www.rethinkdb.com;
    license = stdenv.lib.licenses.agpl3;

    maintainers = [ stdenv.lib.maintainers.bluescreen303 ];
    platforms = stdenv.lib.platforms.all;
  };
}

Revert "rethinkdb: Force dynamic linking and allow dependency substitution"

{ stdenv, fetchurl, which, m4, python
, protobuf, boost, zlib, curl, openssl, icu, jemalloc
}:

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

  src = fetchurl {
    url = "http://download.rethinkdb.com/dist/${name}.tgz";
    sha256 = "19qhia4lfa8a0rzp2v6lnlxp2lf4z4vqhgfxnicfdnx07q4r847i";
  };

  preConfigure = ''
    export ALLOW_WARNINGS=1
    patchShebangs .
  '';

  configureFlags = [
    "--with-jemalloc"
    "--lib-path=${jemalloc}/lib"
  ];

  buildInputs = [ protobuf boost zlib curl openssl icu jemalloc ];

  nativeBuildInputs = [ which m4 python ];

  enableParallelBuilding = true;

  meta = {
    description = "An open-source distributed database built with love";
    longDescription = ''
      RethinkDB is built to store JSON documents, and scale to multiple machines with very little
      effort. It has a pleasant query language that supports really useful queries like table joins
      and group by, and is easy to setup and learn.
    '';
    homepage = http://www.rethinkdb.com;
    license = stdenv.lib.licenses.agpl3;

    maintainers = [ stdenv.lib.maintainers.bluescreen303 ];
    platforms = stdenv.lib.platforms.all;
  };
}


{ stdenv, buildPythonPackage, fetchPypi, cloudpickle, ipykernel, wurlitzer,
  jupyter_client, pyzmq }:

buildPythonPackage rec {
  pname = "spyder-kernels";
  version = "1.6.0";

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

  propagatedBuildInputs = [
    cloudpickle
    ipykernel
    wurlitzer
    jupyter_client
    pyzmq
  ];

  # No tests
  doCheck = false;

  meta = with stdenv.lib; {
    description = "Jupyter kernels for Spyder's console";
    homepage = "https://github.com/spyder-ide/spyder-kernels";
    license = licenses.mit;
    maintainers = with maintainers; [ gebner ];
  };
}

Revert "python: spyder-kernels: 0.5.2 -> 1.6.0"

{ stdenv, buildPythonPackage, fetchPypi, cloudpickle, ipykernel, wurlitzer,
  jupyter_client, pyzmq }:

buildPythonPackage rec {
  pname = "spyder-kernels";
  version = "0.5.2";

  src = fetchPypi {
    inherit pname version;
    sha256 = "01354b7fa180a87212cc005553b31a7300159b108d36828e301d3782291323f7";
  };

  propagatedBuildInputs = [
    cloudpickle
    ipykernel
    wurlitzer
    jupyter_client
    pyzmq
  ];

  # No tests
  doCheck = false;

  meta = with stdenv.lib; {
    description = "Jupyter kernels for Spyder's console";
    homepage = "https://github.com/spyder-ide/spyder-kernels";
    license = licenses.mit;
    maintainers = with maintainers; [ gebner ];
  };
}


{ callPackage, openssl, python3, enableNpm ? true }:

let
  buildNodejs = callPackage ./nodejs.nix {
    inherit openssl;
    python = python3;
  };
in
  buildNodejs {
    inherit enableNpm;
    version = "16.15.1";
    sha256 = "sha256-1OmdPB9pcREJpnUlVxBY5gCc3bwijn1yO4+0pFQWm30=";
    patches = [
      ./disable-darwin-v8-system-instrumentation.patch
    ];
  }

Revert "nodejs-16_x: 16.15.0 -> 16.15.1"

{ callPackage, openssl, python3, enableNpm ? true }:

let
  buildNodejs = callPackage ./nodejs.nix {
    inherit openssl;
    python = python3;
  };
in
  buildNodejs {
    inherit enableNpm;
    version = "16.15.0"; # Do not upgrade until #176127 is solved
    sha256 = "sha256-oPgS78Q/eDIeygiVeWCkj15r+XAE1QWMjdOwPGRupPc=";
    patches = [
      ./disable-darwin-v8-system-instrumentation.patch
    ];
  }


{ pkgs, lib, ... }:

with lib;

{
  hardware.trackpoint = mkDefault {
    enable = true;
    emulateWheel = true;
  };

  hardware.enableRedistributableFirmware = mkDefault true;
  services.tlp.enable = true;

  services.xserver = {
    synaptics.enable = false;
    libinput.enable = true;
  };

  environment.systemPackages = [ pkgs.acpi ];

  sound.enableMediaKeys = true;
}

Use `mkDefault` to avoid make override easier

{ pkgs, lib, ... }:

with lib;

{
  hardware.trackpoint = mkDefault {
    enable = true;
    emulateWheel = true;
  };

  hardware.enableRedistributableFirmware = mkDefault true;
  services.tlp.enable = true;

  services.xserver = mkDefault {
    synaptics.enable = false;
    libinput.enable = true;
  };

  environment.systemPackages = [ pkgs.acpi ];

  sound.enableMediaKeys = mkDefault true;
}


{ gnutar, gzip, git, haskell, haskellPackages, lib, makeWrapper, runc, stdenv }:
let
  inherit (haskell.lib) overrideCabal addBuildDepends;
  inherit (lib) makeBinPath;
  bundledBins = [ gnutar gzip git ] ++ lib.optional stdenv.isLinux runc;

  pkg =
    # justStaticExecutables is needed due to https://github.com/NixOS/nix/issues/2990
    overrideCabal
      (addBuildDepends (haskell.lib.justStaticExecutables haskellPackages.hercules-ci-agent) [ makeWrapper ])
      (o: {
        postInstall = ''
          ${o.postInstall or ""}
          mkdir -p $out/libexec
          mv $out/bin/hercules-ci-agent $out/libexec
          makeWrapper $out/libexec/hercules-ci-agent $out/bin/hercules-ci-agent --prefix PATH : ${makeBinPath bundledBins}
        '';
      });
in pkg // {
    meta = pkg.meta // {
      position = toString ./default.nix + ":1";
    };
  }

Add passthru test for NixOS module eval

{ gnutar, gzip, git, haskell, haskellPackages, lib, makeWrapper, nixos, runc, stdenv }:
let
  inherit (haskell.lib) overrideCabal addBuildDepends;
  inherit (lib) makeBinPath;
  bundledBins = [ gnutar gzip git ] ++ lib.optional stdenv.isLinux runc;

  pkg =
    # justStaticExecutables is needed due to https://github.com/NixOS/nix/issues/2990
    overrideCabal
      (addBuildDepends (haskell.lib.justStaticExecutables haskellPackages.hercules-ci-agent) [ makeWrapper ])
      (o: {
        postInstall = ''
          ${o.postInstall or ""}
          mkdir -p $out/libexec
          mv $out/bin/hercules-ci-agent $out/libexec
          makeWrapper $out/libexec/hercules-ci-agent $out/bin/hercules-ci-agent --prefix PATH : ${makeBinPath bundledBins}
        '';
      });
in pkg.overrideAttrs (o: {
    meta = o.meta // {
      position = toString ./default.nix + ":1";
    };
    passthru = o.passthru // {
      # Does not test the package, but evaluation of the related NixOS module.
      tests.nixos-minimal-config = nixos {
        boot.loader.grub.enable = false;
        fileSystems."/".device = "bogus";
        services.hercules-ci-agent.enable = true;
      };
    };
  })


{ lib
, buildGoModule
, fetchFromGitHub
}:

buildGoModule rec {
  pname = "elfinfo";
  version = "1.2.1";

  src = fetchFromGitHub {
    owner = "xyproto";
    repo = "elfinfo";
    rev = version;
    sha256 = "sha256-vnlPSNyabFjucxHU1w5EPIO9UmTiuCKEzGMC+EZRTtM=";
  };

  vendorSha256 = null;

  meta = with lib; {
    description = "Small utility for showing information about ELF files";
    homepage = "https://elfinfo.roboticoverlords.org/";
    changelog = "https://github.com/xyproto/elfinfo/releases/tag/${version}";
    license = licenses.mit;
    maintainers = with maintainers; [ dtzWill ];
  };
}

Update license according to upstream changelog

{ lib
, buildGoModule
, fetchFromGitHub
}:

buildGoModule rec {
  pname = "elfinfo";
  version = "1.2.1";

  src = fetchFromGitHub {
    owner = "xyproto";
    repo = "elfinfo";
    rev = version;
    sha256 = "sha256-vnlPSNyabFjucxHU1w5EPIO9UmTiuCKEzGMC+EZRTtM=";
  };

  vendorSha256 = null;

  meta = with lib; {
    description = "Small utility for showing information about ELF files";
    homepage = "https://elfinfo.roboticoverlords.org/";
    changelog = "https://github.com/xyproto/elfinfo/releases/tag/${version}";
    license = licenses.bsd3;
    maintainers = with maintainers; [ dtzWill ];
  };
}


{ stdenv, fetchurl }:

stdenv.mkDerivation rec {
  name = "dnsmasq-2.69";

  src = fetchurl {
    url = "http://www.thekelleys.org.uk/dnsmasq/${name}.tar.gz";
    sha256 = "1zf4d6kjbsn6gwfwvmch1y84q67na1qhh0gyd50ip1vjsmw2l4i7";
  };

  makeFlags = "DESTDIR= BINDIR=$(out)/bin MANDIR=$(out)/man LOCALEDIR=$(out)/share/locale";

  meta = {
    description = "An integrated DNS, DHCP and TFTP server for small networks";
    homepage = http://www.thekelleys.org.uk/dnsmasq/doc.html;
    license = "GPL";
    platforms = stdenv.lib.platforms.linux ++ stdenv.lib.platforms.darwin;
    maintainers = [ stdenv.lib.maintainers.eelco ];
  };
}

Update dnsmasq to version 2.71

{ stdenv, fetchurl }:

stdenv.mkDerivation rec {
  name = "dnsmasq-2.71";

  src = fetchurl {
    url = "http://www.thekelleys.org.uk/dnsmasq/${name}.tar.gz";
    sha256 = "1i1l2s2bcs6yx05wh1p2rf4bl0jfdgmg77b33gh44r1rdbv6933x";
  };

  makeFlags = "DESTDIR= BINDIR=$(out)/bin MANDIR=$(out)/man LOCALEDIR=$(out)/share/locale";

  meta = {
    description = "An integrated DNS, DHCP and TFTP server for small networks";
    homepage = http://www.thekelleys.org.uk/dnsmasq/doc.html;
    license = "GPL";
    platforms = stdenv.lib.platforms.linux ++ stdenv.lib.platforms.darwin;
    maintainers = [ stdenv.lib.maintainers.eelco ];
  };
}


{stdenv, fetchurl, aclSupport ? false, acl, perl, gmp}:

stdenv.mkDerivation rec {
  name = "coreutils-8.4";

  src = fetchurl {
    url = "mirror://gnu/coreutils/${name}.tar.gz";
    sha256 = "0zq11lykc7hfs9nsdnb8gqk354l82hswqj38607mvwj3b0zqvc4b";
  };

  buildInputs = [ perl gmp ] ++ stdenv.lib.optional aclSupport acl;

  # The tests are known broken on Cygwin
  # (http://thread.gmane.org/gmane.comp.gnu.core-utils.bugs/19025).
  doCheck = (stdenv.system != "i686-cygwin");

  meta = {
    homepage = http://www.gnu.org/software/coreutils/;
    description = "The basic file, shell and text manipulation utilities of the GNU operating system";

    longDescription = ''
      The GNU Core Utilities are the basic file, shell and text
      manipulation utilities of the GNU operating system.  These are
      the core utilities which are expected to exist on every
      operating system.
    '';

    license = "GPLv3+";

    maintainers = [ stdenv.lib.maintainers.ludo ];
  };
}

Disable tests on non-GNU platforms.

{stdenv, fetchurl, aclSupport ? false, acl, perl, gmp}:

stdenv.mkDerivation rec {
  name = "coreutils-8.4";

  src = fetchurl {
    url = "mirror://gnu/coreutils/${name}.tar.gz";
    sha256 = "0zq11lykc7hfs9nsdnb8gqk354l82hswqj38607mvwj3b0zqvc4b";
  };

  buildInputs = [ perl gmp ] ++ stdenv.lib.optional aclSupport acl;

  # The tests are known broken on Cygwin
  # (http://thread.gmane.org/gmane.comp.gnu.core-utils.bugs/19025),
  # Darwin (http://thread.gmane.org/gmane.comp.gnu.core-utils.bugs/19351),
  # and {Open,Free}BSD.
  doCheck = (stdenv ? glibc);

  meta = {
    homepage = http://www.gnu.org/software/coreutils/;
    description = "The basic file, shell and text manipulation utilities of the GNU operating system";

    longDescription = ''
      The GNU Core Utilities are the basic file, shell and text
      manipulation utilities of the GNU operating system.  These are
      the core utilities which are expected to exist on every
      operating system.
    '';

    license = "GPLv3+";

    maintainers = [ stdenv.lib.maintainers.ludo ];
  };
}


{ lib
, buildPythonPackage
, fetchPypi
, python
, pythonOlder
}:

buildPythonPackage rec {
  pname = "regex";
  version = "2022.3.15";
  format = "setuptools";

  disabled = pythonOlder "3.6";

  src = fetchPypi {
    inherit pname version;
    hash = "sha256-Cnt1zHu0zAM0OABT5GccVg4xJyydLVpsS46a4sm9D4I=";
  };

  checkPhase = ''
    ${python.interpreter} -m unittest
  '';

  pythonImportsCheck = [
    "regex"
  ];

  meta = with lib; {
    description = "Alternative regular expression module, to replace re";
    homepage = "https://bitbucket.org/mrabarnett/mrab-regex";
    license = licenses.psfl;
    maintainers = with maintainers; [ abbradar ];
  };
}

Revert "python3Packages.regex: 2022.3.2 -> 2022.3.15"

{ lib
, buildPythonPackage
, fetchPypi
, python
, pythonOlder
}:

buildPythonPackage rec {
  pname = "regex";
  version = "2022.3.2";
  format = "setuptools";

  disabled = pythonOlder "3.6";

  src = fetchPypi {
    inherit pname version;
    hash = "sha256-eeWvH/JYvA/gvdb2m8SuM5NaiY48vvu8zyLoiif6BTs=";
  };

  checkPhase = ''
    ${python.interpreter} -m unittest
  '';

  pythonImportsCheck = [
    "regex"
  ];

  meta = with lib; {
    description = "Alternative regular expression module, to replace re";
    homepage = "https://bitbucket.org/mrabarnett/mrab-regex";
    license = licenses.psfl;
    maintainers = with maintainers; [ abbradar ];
  };
}


{ pkgs, config, ... }:

{
  # "Attribute set of files to link into the user home."
  home.file = {
    scripts = {
      recursive = true;
      source = "${config.home.homeDirectory}/dotfiles/scripts";
      target = "${config.home.homeDirectory}/.local/bin/scripts";
    };

    bak = {
      executable = true;
      target = "${config.home.homeDirectory}/.local/bin/bak";
      text = ''
        #!/usr/bin/env bash
        sudo rsync -PAXaq --delete-excluded \
            --exclude="${config.xdg.cacheHome}/*" \
            --exclude="${config.xdg.dataHome}/Trash/*" \
            "/home" "/run/media/${config.home.username}/ca3036f2-022d-4b6e-bb03-ed762403fd3b"
      '';
    };

    inputrc = {
      target = "${config.home.homeDirectory}/.inputrc";
      text = ''
        set editing-mode vi
        set show-all-if-ambiguous on
        set show-all-if-unmodified on
        set menu-complete-display-prefix on
        $if mode=vi
          set keymap vi-command
          Control-l: clear-screen
          "k": history-search-backward
          "j": history-search-forward
          set keymap vi-insert
          Control-l: clear-screen
          "jk": vi-movement-mode
          "\t": menu-complete
          "\e[Z": menu-complete-backward
        $endif
      '';
    };
  };
}

Remove q flag from bak

{ pkgs, config, ... }:

{
  # "Attribute set of files to link into the user home."
  home.file = {
    scripts = {
      recursive = true;
      source = "${config.home.homeDirectory}/dotfiles/scripts";
      target = "${config.home.homeDirectory}/.local/bin/scripts";
    };

    bak = {
      executable = true;
      target = "${config.home.homeDirectory}/.local/bin/bak";
      text = ''
        #!/usr/bin/env bash
        sudo rsync -PAXa --delete-excluded \
            --exclude="${config.xdg.cacheHome}/*" \
            --exclude="${config.xdg.dataHome}/Trash/*" \
            "/home" "/run/media/${config.home.username}/ca3036f2-022d-4b6e-bb03-ed762403fd3b"
      '';
    };

    inputrc = {
      target = "${config.home.homeDirectory}/.inputrc";
      text = ''
        set editing-mode vi
        set show-all-if-ambiguous on
        set show-all-if-unmodified on
        set menu-complete-display-prefix on
        $if mode=vi
          set keymap vi-command
          Control-l: clear-screen
          "k": history-search-backward
          "j": history-search-forward
          set keymap vi-insert
          Control-l: clear-screen
          "jk": vi-movement-mode
          "\t": menu-complete
          "\e[Z": menu-complete-backward
        $endif
      '';
    };
  };
}


{ stdenv, fetchFromGitHub, SDL2, SDL2_ttf
, freeimage, fontconfig, pkgconfig
, asciidoc, docbook_xsl, libxslt, cmocka
}:

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

  src = fetchFromGitHub {
    owner  = "eXeC64";
    repo   = "imv";
    rev    = "v${version}";
    sha256 = "0j5aykdkm1g518ism5y5flhwxvjvl92ksq989fhl2wpnv0la82jp";
  };

  buildInputs = [
    SDL2 SDL2_ttf freeimage fontconfig pkgconfig
    asciidoc docbook_xsl libxslt cmocka
  ];

  installFlags = [ "PREFIX=$(out)" "CONFIGPREFIX=$(out)/etc" ];

  meta = with stdenv.lib; {
    description = "A command line image viewer for tiling window managers";
    homepage    = https://github.com/eXeC64/imv;
    license     = licenses.gpl2;
    maintainers = with maintainers; [ rnhmjoj ];
    platforms   = [ "x86_64-linux" ];
  };
}

Include i686-linux in platforms attribute

{ stdenv, fetchFromGitHub, SDL2, SDL2_ttf
, freeimage, fontconfig, pkgconfig
, asciidoc, docbook_xsl, libxslt, cmocka
}:

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

  src = fetchFromGitHub {
    owner  = "eXeC64";
    repo   = "imv";
    rev    = "v${version}";
    sha256 = "0j5aykdkm1g518ism5y5flhwxvjvl92ksq989fhl2wpnv0la82jp";
  };

  buildInputs = [
    SDL2 SDL2_ttf freeimage fontconfig pkgconfig
    asciidoc docbook_xsl libxslt cmocka
  ];

  installFlags = [ "PREFIX=$(out)" "CONFIGPREFIX=$(out)/etc" ];

  meta = with stdenv.lib; {
    description = "A command line image viewer for tiling window managers";
    homepage    = https://github.com/eXeC64/imv;
    license     = licenses.gpl2;
    maintainers = with maintainers; [ rnhmjoj ];
    platforms   = [ "i686-linux" "x86_64-linux" ];
  };
}


{ stdenv, buildPythonApplication, fetchPypi
, python-slugify, requests, urllib3 }:

buildPythonApplication rec {
  pname = "transifex-client";
  version = "0.13.6";

  propagatedBuildInputs = [
    urllib3 requests python-slugify
  ];

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

  prePatch = ''
    substituteInPlace requirements.txt --replace "urllib3<1.24" "urllib3<2.0"
  '';

  # Requires external resources
  doCheck = false;

  meta = with stdenv.lib; {
    homepage = https://www.transifex.com/;
    license = licenses.gpl2;
    description = "Transifex translation service client";
    maintainers = [ maintainers.etu ];
  };
}

Fix build after updated dependencies

{ stdenv, buildPythonApplication, fetchPypi
, python-slugify, requests, urllib3, six }:

buildPythonApplication rec {
  pname = "transifex-client";
  version = "0.13.6";

  propagatedBuildInputs = [
    urllib3 requests python-slugify six
  ];

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

  prePatch = ''
    substituteInPlace requirements.txt --replace "urllib3<1.24" "urllib3<2.0" \
      --replace "six==1.11.0" "six<2.0.0" \
      --replace "python-slugify==1.2.6" "python-slugify<3.0.0"
  '';

  # Requires external resources
  doCheck = false;

  meta = with stdenv.lib; {
    homepage = https://www.transifex.com/;
    license = licenses.gpl2;
    description = "Transifex translation service client";
    maintainers = [ maintainers.etu ];
  };
}


{ lib, buildPythonPackage, fetchFromGitHub, isPy3k, six, flask, pygments, dulwich, httpauth, humanize, pytest, requests, python-ctags3, mock }:

buildPythonPackage rec {
  pname = "klaus";
  version = "2.0.0";

  src = fetchFromGitHub {
    owner = "jonashaag";
    repo = pname;
    rev = version;
    sha256 = "sha256-GyWlIFmP78t+cyPWjjB/EgA/L+2QqHPnmfJ64W5gsf8=";
  };

  prePatch = ''
    substituteInPlace runtests.sh \
      --replace "mkdir -p \$builddir" "mkdir -p \$builddir && pwd"
  '';

  propagatedBuildInputs = [
    six flask pygments dulwich httpauth humanize
  ];

  checkInputs = [
    pytest requests python-ctags3
  ] ++ lib.optional (!isPy3k) mock;

  checkPhase = ''
    ./runtests.sh
  '';

  # Needs to set up some git repos
  doCheck = false;

  meta = with lib; {
    description = "The first Git web viewer that Just Works";
    homepage    = "https://github.com/jonashaag/klaus";
    license     = licenses.isc;
    maintainers = with maintainers; [ pSub ];
  };
}

Remove six dependency, not needed anymore

{ lib, buildPythonPackage, fetchFromGitHub, isPy3k, flask, pygments, dulwich, httpauth, humanize, pytest, requests, python-ctags3, mock }:

buildPythonPackage rec {
  pname = "klaus";
  version = "2.0.0";

  src = fetchFromGitHub {
    owner = "jonashaag";
    repo = pname;
    rev = version;
    sha256 = "sha256-GyWlIFmP78t+cyPWjjB/EgA/L+2QqHPnmfJ64W5gsf8=";
  };

  prePatch = ''
    substituteInPlace runtests.sh \
      --replace "mkdir -p \$builddir" "mkdir -p \$builddir && pwd"
  '';

  propagatedBuildInputs = [
    flask pygments dulwich httpauth humanize
  ];

  checkInputs = [
    pytest requests python-ctags3
  ] ++ lib.optional (!isPy3k) mock;

  checkPhase = ''
    ./runtests.sh
  '';

  # Needs to set up some git repos
  doCheck = false;

  meta = with lib; {
    description = "The first Git web viewer that Just Works";
    homepage    = "https://github.com/jonashaag/klaus";
    license     = licenses.isc;
    maintainers = with maintainers; [ pSub ];
  };
}


{ pkgs, config, ... }:

let
  unstable = import (fetchTarball https://github.com/NixOS/nixpkgs-channels/archive/nixos-unstable.tar.gz) {
    config = config.nixpkgs.config;
  };
in
{
  # CLI packages.
  environment.systemPackages = with pkgs; [
    (python2Full.withPackages(ps: with ps; [ pip tkinter virtualenv ]))
    (python3Full.withPackages(ps: with ps; [ pip tkinter virtualenv ]))
    (unstable.neovim.override ({
      withNodeJs = true;
      vimAlias = true;
      viAlias = true;
    }))
    aria2
    bc
    bind
    curl
    emacs
    fzf
    gcc
    gitFull
    gnumake
    htop
    jq
    lsof
    mediainfo
    pv
    python3Packages.youtube-dl
    ripgrep
    tmux
    universal-ctags
    wget
    xclip
  ];

  # Fonts used in terminal.
  fonts = {
    fonts = with pkgs; [
      hack-font
      inconsolata
      powerline-fonts
      source-code-pro
    ];
  };

  # Enable ZSH.
  programs.zsh = {
    enable = true;
    interactiveShellInit = ''
      if [[ -n "''${commands[fzf-share]}" ]]; then
        source "$(fzf-share)/key-bindings.zsh"
      fi
    '';
  };
}

Bring back vim for fallback

{ pkgs, config, ... }:

let
  unstable = import (fetchTarball https://github.com/NixOS/nixpkgs-channels/archive/nixos-unstable.tar.gz) {
    config = config.nixpkgs.config;
  };
in
{
  # CLI packages.
  environment.systemPackages = with pkgs; [
    (python2Full.withPackages(ps: with ps; [ pip tkinter virtualenv ]))
    (python3Full.withPackages(ps: with ps; [ pip tkinter virtualenv ]))
    (unstable.neovim.override ({
      withNodeJs = true;
    }))
    aria2
    bc
    bind
    curl
    emacs
    fzf
    gcc
    gitFull
    gnumake
    htop
    jq
    lsof
    mediainfo
    pv
    python3Packages.youtube-dl
    ripgrep
    tmux
    universal-ctags
    vim
    wget
    xclip
  ];

  # Fonts used in terminal.
  fonts = {
    fonts = with pkgs; [
      hack-font
      inconsolata
      powerline-fonts
      source-code-pro
    ];
  };

  # Enable ZSH.
  programs.zsh = {
    enable = true;
    interactiveShellInit = ''
      if [[ -n "''${commands[fzf-share]}" ]]; then
        source "$(fzf-share)/key-bindings.zsh"
      fi
    '';
  };
}


{ pkgs, ... }:
{
  home.packages = with pkgs; [
    git
    gitAndTools.diff-so-fancy
    gitAndTools.gh
  ];

  home.file.".gitconfig".source = ./gitconfig;
  home.file.".gitignore".source = ./gitignore;
}

Use gh from home-manager module

{ pkgs, ... }:
{
  home.packages = with pkgs; [
    git
    gitAndTools.diff-so-fancy
  ];

  home.file.".gitconfig".source = ./gitconfig;
  home.file.".gitignore".source = ./gitignore;

  programs.gh = {
    enable = true;
    editor = "emacs";
    gitProtocol = "ssh";
  };
}


{ stdenv, fetchFromGitHub, cmake }:

stdenv.mkDerivation rec {
  name = "libyaml-cpp-${version}";
  version = "0.6.2";

  src = fetchFromGitHub {
    owner = "jbeder";
    repo = "yaml-cpp";
    rev = "yaml-cpp-${version}";
    sha256 = "16lclpa487yghf9019wymj419wkyx4795wv9q7539hhimajw9kpb";
  };

  outputs = [ "out" "dev" ];

  nativeBuildInputs = [ cmake ];

  cmakeFlags = "-DBUILD_SHARED_LIBS=ON";

  meta = with stdenv.lib; {
    inherit (src.meta) homepage;
    description = "A YAML parser and emitter for C++";
    license = licenses.mit;
    platforms = platforms.unix;
    maintainers = with maintainers; [ andir ];
  };
}

Disable build & install of Google Test

{ stdenv, fetchFromGitHub, cmake }:

stdenv.mkDerivation rec {
  name = "libyaml-cpp-${version}";
  version = "0.6.2";

  src = fetchFromGitHub {
    owner = "jbeder";
    repo = "yaml-cpp";
    rev = "yaml-cpp-${version}";
    sha256 = "16lclpa487yghf9019wymj419wkyx4795wv9q7539hhimajw9kpb";
  };

  outputs = [ "out" "dev" ];

  nativeBuildInputs = [ cmake ];

  cmakeFlags = "-DBUILD_SHARED_LIBS=ON -DYAML_CPP_BUILD_TESTS=OFF";

  meta = with stdenv.lib; {
    inherit (src.meta) homepage;
    description = "A YAML parser and emitter for C++";
    license = licenses.mit;
    platforms = platforms.unix;
    maintainers = with maintainers; [ andir ];
  };
}


lib: (lib.recursive-import ./.) // {
  # Run a service with the specified execve settings
  service-with-settings = defnix: service: settings: service // {
    start = defnix.pkgs.run-with-settings service.start settings;
  };

  # If `svc` has an initializer, run `init` after it. Otherwise, use `init`
  # as the initializer
  sequence-initializers = defnix: svc: init: svc // {
    initializer = if (svc.initializer or null) == null
      then init
      else defnix.pkgs.seq "${
        defnix.lib.hashless-basename svc.initializer
      }-and-${
        defnix.lib.hashless-basename init
      }" svc.initializer init;
  };

  # Create a new user and run the service as that user
  run-as-user = defnix: let
    inherit (defnix.defnixos) services;
  in user-spec@{ name, comment }: svc:
    services.sequence-initializers (services.service-with-settings svc {
      user = name;

      group = "nogroup";
    }) (defnix.pkgs.add-user user-spec);
}

Revert "Add a run-as-user service wrapper"

lib: (lib.recursive-import ./.) // {
  # Run a service with the specified execve settings
  service-with-settings = defnix: service: settings: service // {
    start = defnix.pkgs.run-with-settings service.start settings;
  };

  # If `svc` has an initializer, run `init` after it. Otherwise, use `init`
  # as the initializer
  sequence-initializers = defnix: svc: init: svc // {
    initializer = if (svc.initializer or null) == null
      then init
      else defnix.pkgs.seq "${
        defnix.lib.hashless-basename svc.initializer
      }-and-${
        defnix.lib.hashless-basename init
      }" svc.initializer init;
  };
}


{ stdenv, fetchurl, cairo, expat, glib, gtk, jackaudio, ladspaH
, libglade, lv2, pkgconfig }:

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

  src = fetchurl {
    url = "mirror://sourceforge/calf/${name}.tar.gz";
    sha256 = "03w6jjkrr6w8da6qzd0x4dlkg295c6jxby500x4cj07wpbpk6irh";
  };

  buildInputs =
    [ cairo jackaudio gtk glib expat libglade ladspaH lv2 pkgconfig ];

  meta = with stdenv.lib; {
    homepage = http://calf.sourceforge.net;
    description = "A set of high quality open source audio plugins for musicians";
    license = licenses.lgpl2;
    maintainers = [ maintainers.goibhniu ];
  };
}

Update the calf plugin pack to 0.0.19-rc7

{ stdenv, fetchurl, cairo, expat, fftwSinglePrec, fluidsynth, glib, gtk, jackaudio, ladspaH
, libglade, lv2, pkgconfig }:

stdenv.mkDerivation rec {
  name = "calf-${version}";
  version = "0.0.19-rc7";

  src = fetchurl {
    url = "mirror://sourceforge/calf/${name}.tar.gz";
    sha256 = "0515pzc7ishrq0j5hza83s0yp3x34r977h776lpky389whcyf45j";
  };

  buildInputs =
    [ cairo jackaudio fftwSinglePrec fluidsynth gtk glib expat libglade ladspaH lv2 pkgconfig ];

  meta = with stdenv.lib; {
    homepage = http://calf.sourceforge.net;
    description = "A set of high quality open source audio plugins for musicians";
    license = licenses.lgpl2;
    maintainers = [ maintainers.goibhniu ];
  };
}


{ stdenv, fetchFromGitHub, alsaLib, boost
, qt4, libpulseaudio, codec2, libconfig
, gnuradio, gr-osmosdr, gsm
, libopus, libjpeg, protobuf, qwt, speex
} :

let
  version = "0.5.2";

in stdenv.mkDerivation {
  pname = "qradiolink";
  inherit version;

  src = fetchFromGitHub {
    owner = "kantooon";
    repo = "qradiolink";
    rev = version;
    sha256 = "0djhrr96b8sr2vi6hwbzgzlp9771622dp93f0rsphsyxlwbzsrgl";
  };

  preBuild = ''
    cd ext
    protoc --cpp_out=. Mumble.proto
    protoc --cpp_out=. QRadioLink.proto
    cd ..
    qmake
  '';

  installPhase = ''
    mkdir -p $out/bin
    cp qradiolink $out/bin
  '';

  buildInputs = [
    qt4
    alsaLib
    boost
    libpulseaudio
    codec2
    libconfig
    gsm
    gnuradio
    gr-osmosdr
    libopus
    libjpeg
    protobuf
    speex
    qwt
  ];

  enableParallelBuilding = true;

  meta = with stdenv.lib; {
    description = "SDR transceiver application for analog and digital modes";
    homepage = http://qradiolink.org/;
    license = licenses.agpl3;
    maintainers = [ maintainers.markuskowa ];
    platforms = platforms.linux;
  };
}

Revert "qradiolink: 0.5.0 -> 0.5.2"

{ stdenv, fetchFromGitHub, alsaLib, boost
, qt4, libpulseaudio, codec2, libconfig
, gnuradio, gr-osmosdr, gsm
, libopus, libjpeg, protobuf, qwt, speex
} :

let
  version = "0.5.0";

in stdenv.mkDerivation {
  pname = "qradiolink";
  inherit version;

  src = fetchFromGitHub {
    owner = "kantooon";
    repo = "qradiolink";
    rev = version;
    sha256 = "0xhg5zhjznmls5m3rhpk1qx0dipxmca12s85w15d0i7qwva2f1gi";
  };

  preBuild = ''
    cd ext
    protoc --cpp_out=. Mumble.proto
    protoc --cpp_out=. QRadioLink.proto
    cd ..
    qmake
  '';

  installPhase = ''
    mkdir -p $out/bin
    cp qradiolink $out/bin
  '';

  buildInputs = [
    qt4
    alsaLib
    boost
    libpulseaudio
    codec2
    libconfig
    gsm
    gnuradio
    gr-osmosdr
    libopus
    libjpeg
    protobuf
    speex
    qwt
  ];

  enableParallelBuilding = true;

  meta = with stdenv.lib; {
    description = "SDR transceiver application for analog and digital modes";
    homepage = http://qradiolink.org/;
    license = licenses.agpl3;
    maintainers = [ maintainers.markuskowa ];
    platforms = platforms.linux;
  };
}


{ stdenv, fetchurl, automoc4, cmake, gettext, perl, pkgconfig
, kdelibs, networkmanager, libnm-qt }:

let
  pname = "plasma-nm";
  version = "0.9.3.4";
  name = "${pname}-${version}";
in
stdenv.mkDerivation {
  inherit name;

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

  nativeBuildInputs = [ automoc4 cmake gettext perl pkgconfig ];

  buildInputs = [ kdelibs networkmanager libnm-qt ];

  meta = with stdenv.lib; {
    homepage = "https://projects.kde.org/projects/kde/workspace/plasma-nm";
    description = "Plasma applet written in QML for managing network connections";
    license = licenses.lgpl21;
    inherit (kdelibs.meta) platforms;
    maintainers = with maintainers; [ jgeerds ];
  };
}

Remove myself from maintainer list

{ stdenv, fetchurl, automoc4, cmake, gettext, perl, pkgconfig
, kdelibs, networkmanager, libnm-qt }:

let
  pname = "plasma-nm";
  version = "0.9.3.4";
  name = "${pname}-${version}";
in
stdenv.mkDerivation {
  inherit name;

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

  nativeBuildInputs = [ automoc4 cmake gettext perl pkgconfig ];

  buildInputs = [ kdelibs networkmanager libnm-qt ];

  meta = with stdenv.lib; {
    homepage = "https://projects.kde.org/projects/kde/workspace/plasma-nm";
    description = "Plasma applet written in QML for managing network connections";
    license = licenses.lgpl21;
    inherit (kdelibs.meta) platforms;
  };
}


a :
let
  s = import ./src-for-default.nix;
  buildInputs = with a; [
    gmp mpfr
  ];
in
rec {
  src = a.fetchUrlFromSrcInfo s;

  inherit (s) name;
  inherit buildInputs;
  configureFlags = [];

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

  meta = {
    description = "A Lisp implementation aiming to be small and fast";
    maintainers = [
      a.lib.maintainers.raskin
    ];
    platforms = with a.lib.platforms;
      linux;
  };
}

Add some configure options for ECL

a :
let
  s = import ./src-for-default.nix;
  buildInputs = with a; [
    gmp mpfr
  ];
in
rec {
  src = a.fetchUrlFromSrcInfo s;

  inherit (s) name;
  inherit buildInputs;
  configureFlags = [
    "--enable-threads"
    "--enable-unicode"
    ];

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

  meta = {
    description = "A Lisp implementation aiming to be small and fast";
    maintainers = [
      a.lib.maintainers.raskin
    ];
    platforms = with a.lib.platforms;
      linux;
  };
}


{ lib, mkDerivation, fetchFromGitLab
, cmake, pkg-config
, alsa-lib, pipewire
}:

mkDerivation rec {
  pname = "qpwgraph";
  version = "0.2.5";

  src = fetchFromGitLab {
    domain = "gitlab.freedesktop.org";
    owner = "rncbc";
    repo = "qpwgraph";
    rev = "v${version}";
    sha256 = "sha256-OYIBlTO1vXmmY4/ZacvsEQ5EnOfetBvnG2v5xL44czY=";
  };

  nativeBuildInputs = [ cmake pkg-config ];

  buildInputs = [ alsa-lib pipewire ];

  meta = with lib; {
    description = "Qt graph manager for PipeWire, similar to QjackCtl.";
    longDescription = ''
      qpwgraph is a graph manager dedicated for PipeWire,
      using the Qt C++ framework, based and pretty much like
      the same of QjackCtl.
    '';
    homepage = "https://gitlab.freedesktop.org/rncbc/qpwgraph";
    license = licenses.gpl2Plus;
    platforms = platforms.linux;
    maintainers = with maintainers; [ kanashimia ];
  };
}

Add exi as maintainer for qpwgraph

{ lib, mkDerivation, fetchFromGitLab
, cmake, pkg-config
, alsa-lib, pipewire
}:

mkDerivation rec {
  pname = "qpwgraph";
  version = "0.2.5";

  src = fetchFromGitLab {
    domain = "gitlab.freedesktop.org";
    owner = "rncbc";
    repo = "qpwgraph";
    rev = "v${version}";
    sha256 = "sha256-OYIBlTO1vXmmY4/ZacvsEQ5EnOfetBvnG2v5xL44czY=";
  };

  nativeBuildInputs = [ cmake pkg-config ];

  buildInputs = [ alsa-lib pipewire ];

  meta = with lib; {
    description = "Qt graph manager for PipeWire, similar to QjackCtl.";
    longDescription = ''
      qpwgraph is a graph manager dedicated for PipeWire,
      using the Qt C++ framework, based and pretty much like
      the same of QjackCtl.
    '';
    homepage = "https://gitlab.freedesktop.org/rncbc/qpwgraph";
    license = licenses.gpl2Plus;
    platforms = platforms.linux;
    maintainers = with maintainers; [ kanashimia exi ];
  };
}


{ stdenv, fetchurl, munge, lua, libcap, perl, ncurses }:

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

  src = fetchurl {
    url = "https://github.com/chaos/diod/releases/download/${version}/${name}.tar.gz";
    sha256 = "0h92zadbkq4fjhqjzq17cl3x7bdkz2yakpcl0nccv4ml0gwfbx27";
  };

  buildInputs = [ munge lua libcap perl ncurses ];

  meta = {
    description = "An I/O forwarding server that implements a variant of the 9P protocol";
    maintainers = [ stdenv.lib.maintainers.rickynils];
    platforms = stdenv.lib.platforms.linux;
  };
}

Update from 1.0.22 to 1.0.23

{ stdenv, fetchurl, munge, lua, libcap, perl, ncurses }:

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

  src = fetchurl {
    url = "https://github.com/chaos/diod/releases/download/${version}/${name}.tar.gz";
    sha256 = "002vxc9fwdwshda4jydxagr63xd6nnhbc6fh73974gi2pvp6gid3";
  };

  buildInputs = [ munge lua libcap perl ncurses ];

  meta = {
    description = "An I/O forwarding server that implements a variant of the 9P protocol";
    maintainers = [ stdenv.lib.maintainers.rickynils];
    platforms = stdenv.lib.platforms.linux;
  };
}


{
  gwenhywfar.version = "5.1.3";
  gwenhywfar.sha256 = "0xjr9d94y46h7pfdhz5ygn01pmlm66rhiybr520h13nvjh4zid0r";
  gwenhywfar.releaseId = "242";
  libchipcard.version = "5.0.4";
  libchipcard.sha256 = "0fj2h39ll4kiv28ch8qgzdbdbnzs8gl812qnm660bw89rynpjnnj";
  libchipcard.releaseId = "158";
  aqbanking.version = "6.0.2";
  aqbanking.sha256 = "0n41n3yki1wmax4i9wi485g8zqb43z1adywcixzfq9gbdjhz05hx";
  aqbanking.releaseId = "243";
}

Fix download url because of upstream changes

{
  gwenhywfar.version = "5.1.3";
  gwenhywfar.sha256 = "0xjr9d94y46h7pfdhz5ygn01pmlm66rhiybr520h13nvjh4zid0r";
  gwenhywfar.releaseId = "242";
  libchipcard.version = "5.0.4";
  libchipcard.sha256 = "0fj2h39ll4kiv28ch8qgzdbdbnzs8gl812qnm660bw89rynpjnnj";
  libchipcard.releaseId = "158";
  aqbanking.version = "6.0.2";
  aqbanking.sha256 = "0n41n3yki1wmax4i9wi485g8zqb43z1adywcixzfq9gbdjhz05hx";
  aqbanking.releaseId = "273";
}


{ lib
, buildPythonPackage
, fetchPypi
, pythonOlder
, python
, subunit
, testrepository
, testtools
, six
, pbr
, fixtures
, isPy36
}:

buildPythonPackage rec {
  pname = "mox3";
  version = "1.1.0";
  disabled = pythonOlder "3.6";

  src = fetchPypi {
    inherit pname version;
    sha256 = "8a526b7b9b6341f541a9aef3e08c93fd84a5373fe89d4cc51dd571f085b2363c";
  };

  buildInputs = [ subunit testrepository testtools six ];
  propagatedBuildInputs = [ pbr fixtures ];

  # Disabling as several tests depdencies are missing:
  # https://opendev.org/openstack/mox3/src/branch/master/test-requirements.txt
  doCheck = false;

  meta = with lib; {
    description = "Mock object framework for Python";
    homepage = "https://docs.openstack.org/mox3/latest/";
    license = licenses.asl20;
  };

}

Correct a typo in python-modules/mox3

{ lib
, buildPythonPackage
, fetchPypi
, pythonOlder
, python
, subunit
, testrepository
, testtools
, six
, pbr
, fixtures
, isPy36
}:

buildPythonPackage rec {
  pname = "mox3";
  version = "1.1.0";
  disabled = pythonOlder "3.6";

  src = fetchPypi {
    inherit pname version;
    sha256 = "8a526b7b9b6341f541a9aef3e08c93fd84a5373fe89d4cc51dd571f085b2363c";
  };

  buildInputs = [ subunit testrepository testtools six ];
  propagatedBuildInputs = [ pbr fixtures ];

  # Disabling as several tests dependencies are missing:
  # https://opendev.org/openstack/mox3/src/branch/master/test-requirements.txt
  doCheck = false;

  meta = with lib; {
    description = "Mock object framework for Python";
    homepage = "https://docs.openstack.org/mox3/latest/";
    license = licenses.asl20;
  };

}


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

let
  cfg = config.disnixInfrastructure;
in
{
  options = {
    disnixInfrastructure = {
      enable = lib.mkOption {
        default = false;
        description = "Whether to enable infrastructure publishing";
      };

      enableAuthentication = lib.mkOption {
        default = false;
        description = "Whether to publish authentication credentials through the infrastructure attribute (not recommended in combination with Avahi)";
      };

      infrastructure = lib.mkOption {
        default = {};
        description = "An attribute set containing infrastructure model properties";
      };

      properties = lib.mkOption {
        default = {};
        description = "An attribute set container arbitary machine properties";
      };

      generateContainersExpr = lib.mkOption {
        description = "The path to the expression generating the container properties";
        type = lib.types.path;
      };
    };
  };

  config = lib.mkIf cfg.enable {
    disnixInfrastructure.infrastructure = {
      properties = {
        hostname = config.networking.hostName;
      } // cfg.properties;

      system = if config.nixpkgs ? localSystem && config.nixpkgs.localSystem.system != "" then config.nixpkgs.localSystem.system # Support compatiblity with Nixpkgs 17.09 and newer versions
        else if config.nixpkgs.system != "" then config.nixpkgs.system
        else builtins.currentSystem;

      containers = lib.recursiveUpdate (import cfg.generateContainersExpr {
        inherit (cfg) enableAuthentication;
        inherit config lib;
      }) (config.services.dysnomia.extraContainerProperties or {});
    };
  };
}

Fix extra container properties reference

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

let
  cfg = config.disnixInfrastructure;
in
{
  options = {
    disnixInfrastructure = {
      enable = lib.mkOption {
        default = false;
        description = "Whether to enable infrastructure publishing";
      };

      enableAuthentication = lib.mkOption {
        default = false;
        description = "Whether to publish authentication credentials through the infrastructure attribute (not recommended in combination with Avahi)";
      };

      infrastructure = lib.mkOption {
        default = {};
        description = "An attribute set containing infrastructure model properties";
      };

      properties = lib.mkOption {
        default = {};
        description = "An attribute set container arbitary machine properties";
      };

      generateContainersExpr = lib.mkOption {
        description = "The path to the expression generating the container properties";
        type = lib.types.path;
      };
    };
  };

  config = lib.mkIf cfg.enable {
    disnixInfrastructure.infrastructure = {
      properties = {
        hostname = config.networking.hostName;
      } // cfg.properties;

      system = if config.nixpkgs ? localSystem && config.nixpkgs.localSystem.system != "" then config.nixpkgs.localSystem.system # Support compatiblity with Nixpkgs 17.09 and newer versions
        else if config.nixpkgs.system != "" then config.nixpkgs.system
        else builtins.currentSystem;

      containers = lib.recursiveUpdate (import cfg.generateContainersExpr {
        inherit (cfg) enableAuthentication;
        inherit config lib;
      }) (config.dysnomia.extraContainerProperties or {});
    };
  };
}


{ stdenv, fetchgit, openssl, nss, nspr, kerberos, gmp, zlib, libpcap, re2 }:

with stdenv.lib;

stdenv.mkDerivation rec {
  name = "JohnTheRipper-${version}";
  version = "8a3e3c1d";
  buildInputs = [ openssl nss nspr kerberos gmp zlib libpcap re2 ];
  NIX_CFLAGS_COMPILE = "-DJOHN_SYSTEMWIDE=1";
  preConfigure = ''cd src'';
  installPhase = ''
    ensureDir $out/share/john/
    ensureDir $out/bin
    cp -R ../run/* $out/share/john
    ln -s $out/share/john/john $out/bin/john
  '';
  src = fetchgit {
    url = https://github.com/magnumripper/JohnTheRipper.git;
    rev = "93f061bc41652c94ae049b52572aac709d18aa4c";
    sha256 = "1rnfi09830n34jcqaxmsam54p4zsq9a49ic2ljh44lahcipympvy";
  };
  meta = {
    description = "John the Ripper password cracker";
    license = licenses.gpl2;
    homepage = https://github.com/magnumripper/JohnTheRipper/;
    maintainers = with maintainers; [offline];
    platforms = with platforms; unix;
  };
}

Clean up and Update to v1.8.0-jumbo-1.

{ stdenv, fetchurl, openssl, nss, nspr, kerberos, gmp, zlib, libpcap, re2 }:

with stdenv.lib;

stdenv.mkDerivation rec {
  name = "john-${version}";
  version = "1.8.0-jumbo-1";

  src = fetchurl {
    url = "http://www.openwall.com/john/j/${name}.tar.xz";
    sha256 = "08q92sfdvkz47rx6qjn7qv57cmlpy7i7rgddapq5384mb413vjds";
  };

  buildInputs = [ openssl nss nspr kerberos gmp zlib libpcap re2 ];

  NIX_CFLAGS_COMPILE = "-DJOHN_SYSTEMWIDE=1";

  preConfigure = "cd src";

  installPhase = ''
    mkdir -p "$out/share/john"
    mkdir -p "$out/bin"
    cp -R ../run/* "$out/share/john"
    ln -s "$out/share/john/john" "$out/bin/john"
  '';

  meta = {
    description = "John the Ripper password cracker";
    license = licenses.gpl2;
    homepage = https://github.com/magnumripper/JohnTheRipper/;
    maintainers = with maintainers; [ offline ];
    platforms = with platforms; unix;
  };
}


{stdenv, fetchurl, openssl}:
stdenv.mkDerivation {
  name = "msmtp-1.4.21";

  src = fetchurl {
    url = mirror://sourceforge/msmtp/msmtp-1.4.21.tar.bz2;
    sha256 = "1yjgy56n02qs25728psg296amhbdkxq2pv1q3l484f3r9pjrpcrg";
  };

  buildInputs = [ openssl ];

  meta = {
      description = "a MUA";
      homepage = http://msmtp.sourceforge.net/;
      license = "GPL";
    };
}

Update to 1.4.30, added optional libraries as dependency and point to correct license

{ stdenv, fetchurl, openssl, pkgconfig, gnutls, gsasl, libidn }:
stdenv.mkDerivation rec {
  name = "msmtp-1.4.30";

  src = fetchurl {
    url = "mirror://sourceforge/msmtp/${name}.tar.bz2";
    sha256 = "11lq82byx9xyfkf4nrcfjjfv5k8gk3bf8zlw0kml1qrndqlvjlpi";
  };

  buildInputs = [ openssl pkgconfig gnutls gsasl libidn ];

  meta = {
      description = "a MUA";
      homepage = "http://msmtp.sourceforge.net/";
      license = stdenv.lib.licenses.gpl3;
      maintainers = [ stdenv.lib.maintainers.garbas ];
    };
}


{ stdenv, fetchgit, autoreconfHook, pkgconfig, libogg }:

stdenv.mkDerivation {
  name = "tremor-unstable-2018-03-16";

  src = fetchgit {
    url = https://git.xiph.org/tremor.git;
    rev = "562307a4a7082e24553f3d2c55dab397a17c4b4f";
    sha256 = "0m07gq4zfgigsiz8b518xyb19v7qqp76qmp7lb262825vkqzl3zq";
  };

  nativeBuildInputs = [ autoreconfHook pkgconfig ];
  propagatedBuildInputs = [ libogg ];

  preConfigure = ''
    sed -i /XIPH_PATH_OGG/d configure
  '';

  meta = {
    homepage = https://xiph.org/tremor/;
    description = "Fixed-point version of the Ogg Vorbis decoder";
    license = stdenv.lib.licenses.bsd3;
    platforms = stdenv.lib.platforms.unix;
  };
}

Use multiple outputs to reduce closure size

{ stdenv, fetchgit, autoreconfHook, pkgconfig, libogg }:

stdenv.mkDerivation {
  name = "tremor-unstable-2018-03-16";

  src = fetchgit {
    url = https://git.xiph.org/tremor.git;
    rev = "562307a4a7082e24553f3d2c55dab397a17c4b4f";
    sha256 = "0m07gq4zfgigsiz8b518xyb19v7qqp76qmp7lb262825vkqzl3zq";
  };

  outputs = [ "out" "dev" ];

  nativeBuildInputs = [ autoreconfHook pkgconfig ];
  propagatedBuildInputs = [ libogg ];

  preConfigure = ''
    sed -i /XIPH_PATH_OGG/d configure
  '';

  meta = {
    homepage = https://xiph.org/tremor/;
    description = "Fixed-point version of the Ogg Vorbis decoder";
    license = stdenv.lib.licenses.bsd3;
    platforms = stdenv.lib.platforms.unix;
  };
}


{ fetchurl, stdenv, glib, pkgconfig }:

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

  src = fetchurl {
    url = "mirror://sourceforge/gts/${name}.tar.gz";
    sha256 = "07mqx09jxh8cv9753y2d2jsv7wp8vjmrd7zcfpbrddz3wc9kx705";
  };

  buildInputs = [ glib pkgconfig ];

  meta = {
    homepage = http://gts.sourceforge.net/;
    license = "LGPLv2+";
    description = "GNU Triangulated Surface Library";

    longDescription = ''
      Library intended to provide a set of useful functions to deal with
      3D surfaces meshed with interconnected triangles.
    '';

    maintainers = [ stdenv.lib.maintainers.viric ];
    platforms = stdenv.lib.platforms.linux;
  };
}

Fix compliation of gts on Darwin

{ fetchurl, stdenv, glib, pkgconfig, gettext }:

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

  src = fetchurl {
    url = "mirror://sourceforge/gts/${name}.tar.gz";
    sha256 = "07mqx09jxh8cv9753y2d2jsv7wp8vjmrd7zcfpbrddz3wc9kx705";
  };

  buildInputs = [ glib pkgconfig ] ++ stdenv.lib.optional (stdenv.system == "x86_64-darwin") gettext;

  meta = {
    homepage = http://gts.sourceforge.net/;
    license = "LGPLv2+";
    description = "GNU Triangulated Surface Library";

    longDescription = ''
      Library intended to provide a set of useful functions to deal with
      3D surfaces meshed with interconnected triangles.
    '';

    maintainers = [ stdenv.lib.maintainers.viric ];
    platforms = stdenv.lib.platforms.linux;
  };
}


{ stdenv, fetchurl, cmake, qt4, libgadu, libXScrnSaver, libsndfile, libX11,
  alsaLib, aspell, libidn, qca2 }:

stdenv.mkDerivation {

  name = "kadu-0.9.2";

  src = fetchurl {
    url = http://www.kadu.net/download/stable/kadu-0.9.2.tar.bz2;
    sha256 = "05lpx7m2adx8vv4h62rsiwlgay24m6cxdbibg7vzl4xkq9ybv30b";
  };

  buildInputs = [
    cmake qt4 libgadu libXScrnSaver libsndfile libX11 alsaLib aspell libidn qca2
  ];

  configureFlags = "CPPFLAGS=-DQT_NO_DEBUG";

  cmakeFlags = "-DENABLE_AUTODOWNLOAD=OFF -DBUILD_DESCRIPTION='NixOS' -DCMAKE_BUILD_TYPE=Release";

  prePatch = ''
    patchShebangs .
  '';

  patches = [ ./config.patch ];

  NIX_LDFLAGS="-lX11";

  meta = {
    description = "An instant-messenger client for the gadu-gadu network (most popular polish IM network)";
    homepage = http://www.kadu.net/w/English:Main_Page;
    license = "GPLv2";
    platforms = stdenv.lib.platforms.linux;
  };
}

Repair kadu to get it building again.

{ stdenv, fetchurl, cmake, qt4, libgadu, libXScrnSaver, libsndfile, libX11,
  alsaLib, aspell, libidn, qca2, phonon }:

stdenv.mkDerivation {

  name = "kadu-0.9.2";

  src = fetchurl {
    url = http://www.kadu.net/download/stable/kadu-0.9.2.tar.bz2;
    sha256 = "05lpx7m2adx8vv4h62rsiwlgay24m6cxdbibg7vzl4xkq9ybv30b";
  };

  buildInputs = [
    cmake qt4 libgadu libXScrnSaver libsndfile libX11 alsaLib aspell libidn qca2 phonon
  ];

  configureFlags = "CPPFLAGS=-DQT_NO_DEBUG";

  cmakeFlags = "-DENABLE_AUTODOWNLOAD=OFF -DBUILD_DESCRIPTION='NixOS' -DCMAKE_BUILD_TYPE=Release";

  prePatch = ''
    patchShebangs .
  '';

  patches = [ ./config.patch ];

  NIX_LDFLAGS="-lX11";

  meta = {
    description = "An instant-messenger client for the gadu-gadu network (most popular polish IM network)";
    homepage = http://www.kadu.net/w/English:Main_Page;
    license = "GPLv2";
    platforms = stdenv.lib.platforms.linux;
  };
}


{ lib, stdenv, fetchFromGitHub, autoreconfHook, scheme48 }:

stdenv.mkDerivation {
  pname = "scsh";
  version = "0.7pre";

  src = fetchFromGitHub {
    owner = "scheme";
    repo = "scsh";
    rev = "f99b8c5293628cfeaeb792019072e3a96841104f";
    sha256 = "sha256-vcVtqoUhozdJq1beUN8/rcI2qOJYUN+0CPSiDWGCIjI=";
    fetchSubmodules = true;
  };

  nativeBuildInputs = [ autoreconfHook ];
  buildInputs = [ scheme48 ];
  configureFlags = [ "--with-scheme48=${scheme48}" ];

  meta = with lib; {
    description = "A Scheme shell";
    homepage = "http://www.scsh.net/";
    license = licenses.bsd3;
    maintainers = with maintainers; [ joachifm ];
    platforms = with platforms; unix;
  };
}

Update to latest head, unbreaking the build

{ lib, stdenv, fetchFromGitHub, autoreconfHook, scheme48 }:

stdenv.mkDerivation {
  pname = "scsh";
  version = "0.7pre";

  src = fetchFromGitHub {
    owner = "scheme";
    repo = "scsh";
    rev = "4acf6e4ed7b65b46186ef0c9c2a1e10bef8dc052";
    sha256 = "sha256-92NtMK5nVd6+WtHj/Rk6iQEkGsNEZySTVZkkbqKrLYY=";
    fetchSubmodules = true;
  };

  nativeBuildInputs = [ autoreconfHook ];
  buildInputs = [ scheme48 ];
  configureFlags = [ "--with-scheme48=${scheme48}" ];

  meta = with lib; {
    description = "A Scheme shell";
    homepage = "http://www.scsh.net/";
    license = licenses.bsd3;
    maintainers = with maintainers; [ joachifm ];
    platforms = with platforms; unix;
  };
}


{ cabal, aeson, syb }:

cabal.mkDerivation (self: {
  pname = "pandoc-types";
  version = "1.12";
  sha256 = "1dn5zl6r1vvnqcsdxdd5cv0n44rbffg3sm2jxpvcv9846wpaj8qj";
  buildDepends = [ aeson syb ];
  meta = {
    homepage = "http://johnmacfarlane.net/pandoc";
    description = "Types for representing a structured document";
    license = "GPL";
    platforms = self.ghc.meta.platforms;
    maintainers = [ self.stdenv.lib.maintainers.andres ];
  };
})

Revert "update to version 1.12"

{ cabal, syb }:

cabal.mkDerivation (self: {
  pname = "pandoc-types";
  version = "1.10";
  sha256 = "1xbqvgb95h0jhqx2y0jzds3xvycx5gwi3xn6agdmfkg7xhx9hnz6";
  buildDepends = [ syb ];
  meta = {
    homepage = "http://johnmacfarlane.net/pandoc";
    description = "Types for representing a structured document";
    license = "GPL";
    platforms = self.ghc.meta.platforms;
    maintainers = [ self.stdenv.lib.maintainers.andres ];
  };
})


{stdenv, fetchurl, ocaml, findlib, camlp4}:

let
  ocaml_version = (builtins.parseDrvName ocaml.name).version;
in

stdenv.mkDerivation {
  name = "ounit-2.0.0";

  src = fetchurl {
    url = http://forge.ocamlcore.org/frs/download.php/886/ounit-2.0.0.tar.gz;
    sha256 = "1qw8k2czy0bxhsf25kfpgywhpqmg7bi57rmyhlnmbddmvc61pg76";
  };

  buildInputs = [ocaml findlib camlp4];

  dontAddPrefix = true;

  doCheck = true;

  checkTarget = "test";

  createFindlibDestdir = true;

  meta = {
    homepage = http://www.xs4all.nl/~mmzeeman/ocaml/;
    description = "Unit test framework for OCaml";
    license = stdenv.lib.licenses.mit;
    platforms = ocaml.meta.platforms;
    maintainers = [
      stdenv.lib.maintainers.z77z
    ];
  };
}

Update OUnit to version 2.0.0

{stdenv, fetchurl, ocaml, findlib, camlp4}:

let
  ocaml_version = (builtins.parseDrvName ocaml.name).version;
in

stdenv.mkDerivation {
  name = "ounit-2.0.0";

  src = fetchurl {
    url = https://forge.ocamlcore.org/frs/download.php/1258/ounit-2.0.0.tar.gz;
    sha256 = "118xsadrx84pif9vaq13hv4yh22w9kmr0ypvhrs0viir1jr0ajjd";
  };

  buildInputs = [ocaml findlib camlp4];

  dontAddPrefix = true;

  doCheck = true;

  checkTarget = "test";

  createFindlibDestdir = true;

  meta = {
    homepage = http://www.xs4all.nl/~mmzeeman/ocaml/;
    description = "Unit test framework for OCaml";
    license = stdenv.lib.licenses.mit;
    platforms = ocaml.meta.platforms;
    maintainers = [
      stdenv.lib.maintainers.z77z
    ];
  };
}


{ stdenv, fetchurl }:

stdenv.mkDerivation {
  name = "byacc-1.9";

  src = fetchurl {
    url = http://invisible-island.net/datafiles/release/byacc.tar.gz;
    sha256 = "1rbzx5ipkvih9rjfdfv6310wcr6mxjbdlsh9zcv5aaz6yxxxil7c";
  };

  meta = {
    description = "Berkeley YACC";
    homepage = http://dickey.his.com/byacc/byacc.html;
    license = "public domain";
  };
}

Use a more permanent URL for the byacc version we're using

{ stdenv, fetchurl }:

stdenv.mkDerivation {
  name = "byacc-1.9";

  src = fetchurl {
    url = ftp://invisible-island.net/byacc/byacc-20140715.tgz;
    sha256 = "1rbzx5ipkvih9rjfdfv6310wcr6mxjbdlsh9zcv5aaz6yxxxil7c";
  };

  meta = {
    description = "Berkeley YACC";
    homepage = http://dickey.his.com/byacc/byacc.html;
    license = "public domain";
  };
}


{ system ? builtins.currentSystem,
  config ? {},
  pkgs ? import ../.. { inherit system config; }
}:

with import ../lib/testing.nix { inherit system pkgs; };

let
  output = runInMachine {
    drv = pkgs.hello;
    machine = { ... }: { /* services.sshd.enable = true; */ };
  };
in pkgs.runCommand "verify-output" { inherit output; } ''
  if [ ! -e "$output/bin/hello" ]; then
    echo "Derivation built using runInMachine produced incorrect output:" >&2
    ls -laR "$output" >&2
    exit 1
  fi
  "$output/bin/hello" > "$out"
''

Fix wrong arch in runInMachine test

{ system ? builtins.currentSystem,
  config ? {},
  pkgs ? import ../.. { inherit system config; }
}:

with import ../lib/testing.nix { inherit system pkgs; };

let
  output = runInMachine {
    drv = pkgs.hello;
    machine = { ... }: { /* services.sshd.enable = true; */ };
  };

  test = pkgs.runCommand "verify-output" { inherit output; } ''
    if [ ! -e "$output/bin/hello" ]; then
      echo "Derivation built using runInMachine produced incorrect output:" >&2
      ls -laR "$output" >&2
      exit 1
    fi
    "$output/bin/hello" > "$out"
  '';

in test // { inherit test; } # To emulate behaviour of makeTest


args : with args;
rec {
  src = fetchurl {
    url = http://downloads.sourceforge.net/jfsrec/jfsrec-svn-7.tar.gz;
    sha256 = "163z6ljr05vw2k5mj4fim2nlg4khjyibrii95370pvn474mg28vg";
  };

  buildInputs = [boost];
  configureFlags = [];

  doFixBoost = fullDepEntry (''
    sed -e 's/-lboost_[a-z_]*/&-mt/g' -i src/Makefile.in
  '') ["minInit" "doUnpack"];

  doFixInc = fullDepEntry (''
    sed -e '/[#]include [<]config.h[>]/a\#include <string.h>' -i src/unicode_to_utf8.cpp
    cat src/unicode_to_utf8.cpp
  '') ["minInit" "doUnpack"];

  /* doConfigure should be specified separately */
  phaseNames = ["doFixBoost" "doFixInc" "doConfigure" "doMakeInstall"];

  name = "jfsrec-" + version;
  meta = {
    description = "JFS recovery tool";
  };
}

Boost library reference change no longer needed

args : with args;
rec {
  src = fetchurl {
    url = http://downloads.sourceforge.net/jfsrec/jfsrec-svn-7.tar.gz;
    sha256 = "163z6ljr05vw2k5mj4fim2nlg4khjyibrii95370pvn474mg28vg";
  };

  buildInputs = [boost];
  configureFlags = [];

  doFixInc = fullDepEntry (''
    sed -e '/[#]include [<]config.h[>]/a\#include <string.h>' -i src/unicode_to_utf8.cpp
    cat src/unicode_to_utf8.cpp
  '') ["minInit" "doUnpack"];

  /* doConfigure should be specified separately */
  phaseNames = ["doFixInc" "doConfigure" "doMakeInstall"];

  name = "jfsrec-" + version;
  meta = {
    description = "JFS recovery tool";
  };
}