{ stdenv, fetchurl, python, bzip2, zlib, gmp, openssl, boost
# Passed by version specific builders
, baseVersion, revision, sha256
, ...
}:

stdenv.mkDerivation rec {
  name = "botan-${version}";
  version = "${baseVersion}.${revision}";

  src = fetchurl {
    name = "Botan-${version}.tgz";
    url = "http://files.randombit.net/botan/v${baseVersion}/Botan-${version}.tbz";
    inherit sha256;
  };

  buildInputs = [ python bzip2 zlib gmp openssl boost ];

  configurePhase = ''
    python configure.py --prefix=$out --with-gnump --with-bzip2 --with-zlib ${if openssl != null then "--with-openssl" else ""}
  '';

  enableParallelBuilding = true;

  preInstall = ''
    patchShebangs src/scripts
  '';

  postInstall = ''
    cd "$out"/lib/pkgconfig
    ln -s botan-*.pc botan.pc || true
  '';

  meta = with stdenv.lib; {
    inherit version;
    description = "Cryptographic algorithms library";
    maintainers = with maintainers; [ raskin ];
    platforms = platforms.unix;
    license = licenses.bsd2;
  };
  passthru.updateInfo.downloadPage = "http://files.randombit.net/botan/";
}

Fix the download link --- reported by Karn Kallio

{ stdenv, fetchurl, python, bzip2, zlib, gmp, openssl, boost
# Passed by version specific builders
, baseVersion, revision, sha256
, ...
}:

stdenv.mkDerivation rec {
  name = "botan-${version}";
  version = "${baseVersion}.${revision}";

  src = fetchurl {
    name = "Botan-${version}.tgz";
    url = "http://files.randombit.net/botan/v${baseVersion}/Botan-${version}.tgz";
    inherit sha256;
  };

  buildInputs = [ python bzip2 zlib gmp openssl boost ];

  configurePhase = ''
    python configure.py --prefix=$out --with-gnump --with-bzip2 --with-zlib ${if openssl != null then "--with-openssl" else ""}
  '';

  enableParallelBuilding = true;

  preInstall = ''
    patchShebangs src/scripts
  '';

  postInstall = ''
    cd "$out"/lib/pkgconfig
    ln -s botan-*.pc botan.pc || true
  '';

  meta = with stdenv.lib; {
    inherit version;
    description = "Cryptographic algorithms library";
    maintainers = with maintainers; [ raskin ];
    platforms = platforms.unix;
    license = licenses.bsd2;
  };
  passthru.updateInfo.downloadPage = "http://files.randombit.net/botan/";
}


{ stdenv, fetchurl, alsaLib, autoconf, automake, fftw, gettext, glib,
libX11, libtool, tcl, tk }:

stdenv.mkDerivation  rec {
  name = "puredata-${version}";
  version = "0.43-0";

  src = fetchurl {
    url = "mirror://sourceforge/pure-data/pd-${version}.src.tar.gz";
    sha256 = "1qfq7x8vj12kr0cdrnbvmxfhc03flicc6vcc8bz6hwrrakwciyz2";
  };

  buildInputs = [ alsaLib autoconf automake fftw gettext glib libX11
    libtool tcl tk ];

  preConfigure = ''
    ./autogen.sh
  '';

  meta = with stdenv.lib; {
    description = ''Real-time graphical programming environment for
                    audio, video, and graphical processing'';
    homepage = http://puredata.info;
    license = licenses.bsd3;
    platforms = platforms.linux;
    maintainers = [ maintainers.goibhniu ];
  };
}

Update to 0.44, add support for JACK and fix wrapper

{ stdenv, fetchurl, alsaLib, autoconf, automake, fftw, gettext, glib
, jackaudio, libX11, libtool, makeWrapper, pkgconfig, tcl, tk
}:

stdenv.mkDerivation  rec {
  name = "puredata-${version}";
  version = "0.44-0";

  src = fetchurl {
    url = "mirror://sourceforge/pure-data/pd-${version}.src.tar.gz";
    sha256 = "031bvqfnlpfx0y5n0l5rmslziqc6jgmk99x1prgh1rmhjhjdnijw";
  };

  buildInputs = [
    alsaLib autoconf automake fftw gettext glib jackaudio libX11
    libtool makeWrapper pkgconfig tcl tk
  ];

  preConfigure = ''
    ./autogen.sh
  '';

  postInstall = ''
    wrapProgram $out/bin/pd --prefix PATH : ${tk}/bin
  '';

  meta = with stdenv.lib; {
    description = ''A real-time graphical programming environment for
                    audio, video, and graphical processing'';
    homepage = http://puredata.info;
    license = licenses.bsd3;
    platforms = platforms.linux;
    maintainers = [ maintainers.goibhniu ];
  };
}


{ lib, stdenv, fetchFromGitHub, kernel }:

stdenv.mkDerivation rec {
  pname = "acpi-call";
  version = "2020-04-07-${kernel.version}";

  src = fetchFromGitHub {
    owner = "nix-community";
    repo = "acpi_call";
    rev = "3d7c9fe5ed3fc5ed5bafd39d54b1fdc7a09ce710";
    sha256 = "09kp8zl392h99wjwzqrdw2xcfnsc944hzmfwi8n1y7m2slpdybv3";
  };

  hardeningDisable = [ "pic" ];

  nativeBuildInputs = kernel.moduleBuildDependencies;

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

  installPhase = ''
    install -D acpi_call.ko $out/lib/modules/${kernel.modDirVersion}/misc/acpi_call.ko
    install -D -m755 examples/turn_off_gpu.sh $out/bin/test_discrete_video_off.sh
  '';

  meta = with lib; {
    maintainers = with maintainers; [ raskin mic92 ];
    inherit (src.meta) homepage;
    platforms = platforms.linux;
    description = "A module allowing arbitrary ACPI calls; use case: hybrid video";
  };
}

Replace commit with equivalent from master

{ lib, stdenv, fetchFromGitHub, kernel }:

stdenv.mkDerivation rec {
  pname = "acpi-call";
  version = "2020-04-07-${kernel.version}";

  src = fetchFromGitHub {
    owner = "nix-community";
    repo = "acpi_call";
    rev = "fe4cd0124099b88b61f83006023bc0d95e742e75";
    sha256 = "1rksbg78i7y2wzam9p6kbhx8rmkaiq0kqg8nj7k0j6d25m79289s";
  };

  hardeningDisable = [ "pic" ];

  nativeBuildInputs = kernel.moduleBuildDependencies;

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

  installPhase = ''
    install -D acpi_call.ko $out/lib/modules/${kernel.modDirVersion}/misc/acpi_call.ko
    install -D -m755 examples/turn_off_gpu.sh $out/bin/test_discrete_video_off.sh
  '';

  meta = with lib; {
    maintainers = with maintainers; [ raskin mic92 ];
    inherit (src.meta) homepage;
    platforms = platforms.linux;
    description = "A module allowing arbitrary ACPI calls; use case: hybrid video";
  };
}


{ stdenv, fetchurl, pkgconfig, intltool, libxml2, glib, json_glib
, gobjectIntrospection, liboauth, gnome3, p11_kit, openssl, uhttpmock }:

let
  majorVersion = "0.17";
in
stdenv.mkDerivation rec {
  name = "libgdata-${majorVersion}.4";

  src = fetchurl {
    url = "mirror://gnome/sources/libgdata/${majorVersion}/${name}.tar.xz";
    sha256 = "1xniw4y90hbk9fa548pa9pfclibw7amr2f458lfh16jdzq7gw5cz";
  };

  NIX_CFLAGS_COMPILE = "-I${gnome3.libsoup}/include/libsoup-gnome-2.4/ -I${gnome3.gcr}/include/gcr-3 -I${gnome3.gcr}/include/gck-1";

  buildInputs = with gnome3;
    [ pkgconfig libsoup intltool libxml2 glib gobjectIntrospection
      liboauth gcr gnome_online_accounts p11_kit openssl uhttpmock ];

  propagatedBuildInputs = [ json_glib ];

  meta = with stdenv.lib; {
    description = "GData API library";
    maintainers = with maintainers; [ raskin lethalman ];
    platforms = platforms.linux;
    license = licenses.lgpl21Plus;
  };

}

Make explicit that 'dev' output of gnome3.libsoup is used

{ stdenv, fetchurl, pkgconfig, intltool, libxml2, glib, json_glib
, gobjectIntrospection, liboauth, gnome3, p11_kit, openssl, uhttpmock }:

let
  majorVersion = "0.17";
in
stdenv.mkDerivation rec {
  name = "libgdata-${majorVersion}.4";

  src = fetchurl {
    url = "mirror://gnome/sources/libgdata/${majorVersion}/${name}.tar.xz";
    sha256 = "1xniw4y90hbk9fa548pa9pfclibw7amr2f458lfh16jdzq7gw5cz";
  };

  NIX_CFLAGS_COMPILE = "-I${gnome3.libsoup.dev}/include/libsoup-gnome-2.4/ -I${gnome3.gcr}/include/gcr-3 -I${gnome3.gcr}/include/gck-1";

  buildInputs = with gnome3;
    [ pkgconfig libsoup intltool libxml2 glib gobjectIntrospection
      liboauth gcr gnome_online_accounts p11_kit openssl uhttpmock ];

  propagatedBuildInputs = [ json_glib ];

  meta = with stdenv.lib; {
    description = "GData API library";
    maintainers = with maintainers; [ raskin lethalman ];
    platforms = platforms.linux;
    license = licenses.lgpl21Plus;
  };

}


{ stdenv
, fetchurl
, gmp
, mpfr
}:

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

  src = fetchurl {
    url = "http://www.multiprecision.org/mpc/download/mpc-${version}.tar.gz";
    sha256 = "1hzci2zrrd7v3g1jk35qindq05hbl0bhjcyyisq9z209xb3fqzb1";
  };

  buildInputs = [
    gmp
    mpfr
  ];

  doCheck = true;

  meta = with stdenv.lib; {
    description = "Library for multiprecision complex arithmetic with exact rounding";
    homepage = http://mpc.multiprecision.org/;
    license = stdenv.lib.licenses.lgpl2Plus;
    maintainers = with maintainers; [
      wkennington
    ];
    platforms = with platforms;
      i686-linux
      ++ x86_64-linux;
  };
}

Fix url and add source verification

{ stdenv
, fetchurl
, gmp
, mpfr
}:

let
  version = "1.0.3";
in
stdenv.mkDerivation rec {
  name = "libmpc-${version}";

  src = fetchurl {
    url = "mirror://gnu/mpc/mpc-${version}.tar.gz";
    hashOutput = false;
    sha256 = "1hzci2zrrd7v3g1jk35qindq05hbl0bhjcyyisq9z209xb3fqzb1";
  };

  buildInputs = [
    gmp
    mpfr
  ];

  doCheck = true;

  passthru = {
    srcVerification = fetchurl {
      failEarly = true;
      pgpsigUrls = map (n: "${n}.sig") src.urls;
      pgpKeyFingerprint = "AED6 E2A1 85EE B379 F174  76D2 E012 D07A D0E3 CC30";
      inherit (src) urls outputHash outputHashAlgo;
    };
  };

  meta = with stdenv.lib; {
    description = "Library for multiprecision complex arithmetic with exact rounding";
    homepage = http://mpc.multiprecision.org/;
    license = stdenv.lib.licenses.lgpl2Plus;
    maintainers = with maintainers; [
      wkennington
    ];
    platforms = with platforms;
      i686-linux
      ++ x86_64-linux;
  };
}


{ config, pkgs, ... }:

{
  nixpkgs.config.firefox =
    { #enableGnomeExtensions = true;
      #enableGoogleTalkPlugin = true;
      enableAdobeFlash = true;
    };

  environment.systemPackages = with pkgs;
    [ # Shells
      zsh

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

      # Browser
      firefoxWrapper

      # Development
      (git.override { guiSupport = true; })

      # Desktop Env
      dmenu

      # Bits of Gnome
      # gnome3.gnome_terminal
      evince

      # Terminal emulator
      termite

      # Admin
      acpi
      file
      gparted
      htop
      pciutils
      tree
      wget

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

  nix = {
    binaryCaches = [
      "http://cache.nixos.org/"
    ];
    trustedBinaryCaches = [
      "https://hydra.nixos.org/"
      "http://hydra.cryp.to"
      "https://nixcache.reflex-frp.org"
    ];
    binaryCachePublicKeys = [
      "ryantrinkle.com-1:JJiAKaRv9mWgpVAz8dwewnZe0AzzEAzPkagE9SP5NWI="
    ];
  };
}

Make sure we have gdisk

{ config, pkgs, ... }:

{
  nixpkgs.config.firefox =
    { #enableGnomeExtensions = true;
      #enableGoogleTalkPlugin = true;
      enableAdobeFlash = true;
    };

  environment.systemPackages = with pkgs;
    [ # Shells
      zsh

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

      # Browser
      firefoxWrapper

      # Development
      (git.override { guiSupport = true; })

      # Desktop Env
      dmenu

      # Bits of Gnome
      # gnome3.gnome_terminal
      evince

      # Terminal emulator
      termite

      # Admin
      acpi
      file
      gptfdisk
      gparted
      htop
      pciutils
      tree
      wget

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

  nix = {
    binaryCaches = [
      "http://cache.nixos.org/"
    ];
    trustedBinaryCaches = [
      "https://hydra.nixos.org/"
      "http://hydra.cryp.to"
      "https://nixcache.reflex-frp.org"
    ];
    binaryCachePublicKeys = [
      "ryantrinkle.com-1:JJiAKaRv9mWgpVAz8dwewnZe0AzzEAzPkagE9SP5NWI="
    ];
  };
}


{stdenv, fetchurl, gmp}:

stdenv.mkDerivation {
  name = "mpfr-2.4.0";

  src = fetchurl {
    urls = [
      http://gforge.inria.fr/frs/download.php/16015/mpfr-2.4.0.tar.bz2
      http://www.mpfr.org/mpfr-2.4.0/mpfr-2.4.0.tar.bz2
    ];
    sha256 = "17ajw12jfs721igsr6ny3wxz9j1nm618iplc82wyzins5gn52gdy";
  };

  buildInputs = [gmp];

  meta = {
    homepage = http://www.mpfr.org/;
    description = "Library for multiple-precision floating-point arithmetic";
  };
}

Update description for MPFR, now a GNU project.

{stdenv, fetchurl, gmp}:

stdenv.mkDerivation {
  name = "mpfr-2.4.0";

  src = fetchurl {
    urls = [
      http://gforge.inria.fr/frs/download.php/16015/mpfr-2.4.0.tar.bz2
      http://www.mpfr.org/mpfr-2.4.0/mpfr-2.4.0.tar.bz2
    ];
    sha256 = "17ajw12jfs721igsr6ny3wxz9j1nm618iplc82wyzins5gn52gdy";
  };

  buildInputs = [gmp];

  meta = {
    homepage = http://www.mpfr.org/;
    description = "GNU MPFR, a library for multiple-precision floating-point arithmetic";

    longDescription = ''
      The GNU MPFR library is a C library for multiple-precision
      floating-point computations with correct rounding.  MPFR is
      based on the GMP multiple-precision library.

      The main goal of MPFR is to provide a library for
      multiple-precision floating-point computation which is both
      efficient and has a well-defined semantics.  It copies the good
      ideas from the ANSI/IEEE-754 standard for double-precision
      floating-point arithmetic (53-bit mantissa).
    '';

    license = "LGPLv2+";
  };
}


{ lib, buildPythonPackage, fetchFromGitHub
, isPy3k, attrs, coverage, enum34, pexpect
, doCheck ? true, pytest, pytest_xdist, flaky, mock
}:
buildPythonPackage rec {
  # https://hypothesis.readthedocs.org/en/latest/packaging.html

  # Hypothesis has optional dependencies on the following libraries
  # pytz fake_factory django numpy pytest
  # If you need these, you can just add them to your environment.

  version = "4.56.1";
  pname = "hypothesis";

  # Use github tarballs that includes tests
  src = fetchFromGitHub {
    owner = "HypothesisWorks";
    repo = "hypothesis-python";
    rev = "hypothesis-python-${version}";
    sha256 = "09bpwp4kdywkmzci969m57w0yy8c31kzwg60vg4mvrmmgyi2cfzv";
  };

  postUnpack = "sourceRoot=$sourceRoot/hypothesis-python";

  propagatedBuildInputs = [ attrs coverage ] ++ lib.optional (!isPy3k) enum34;

  checkInputs = [ pytest pytest_xdist flaky mock pexpect ];
  inherit doCheck;

  checkPhase = ''
    rm tox.ini # This file changes how py.test runs and breaks it
    py.test tests/cover
  '';

  meta = with lib; {
    description = "A Python library for property based testing";
    homepage = https://github.com/HypothesisWorks/hypothesis;
    license = licenses.mpl20;
  };
}

Revert "python3Packages.hypothesis: 4.41.0 -> 4.56.1"

{ lib, buildPythonPackage, fetchFromGitHub
, isPy3k, attrs, coverage, enum34, pexpect
, doCheck ? true, pytest, pytest_xdist, flaky, mock
}:
buildPythonPackage rec {
  # https://hypothesis.readthedocs.org/en/latest/packaging.html

  # Hypothesis has optional dependencies on the following libraries
  # pytz fake_factory django numpy pytest
  # If you need these, you can just add them to your environment.

  version = "4.41.0";
  pname = "hypothesis";

  # Use github tarballs that includes tests
  src = fetchFromGitHub {
    owner = "HypothesisWorks";
    repo = "hypothesis-python";
    rev = "hypothesis-python-${version}";
    sha256 = "09bpwp4kdywkmzci969m57w0yy8c31kzwg60vg4mvrmmgyi2cfzv";
  };

  postUnpack = "sourceRoot=$sourceRoot/hypothesis-python";

  propagatedBuildInputs = [ attrs coverage ] ++ lib.optional (!isPy3k) enum34;

  checkInputs = [ pytest pytest_xdist flaky mock pexpect ];
  inherit doCheck;

  checkPhase = ''
    rm tox.ini # This file changes how py.test runs and breaks it
    py.test tests/cover
  '';

  meta = with lib; {
    description = "A Python library for property based testing";
    homepage = https://github.com/HypothesisWorks/hypothesis;
    license = licenses.mpl20;
  };
}


{ stdenv, fetchurl, jre, makeWrapper, bash }:

let
  kafkaVersion = "0.8.1.1";
  scalaVersion = "2.8.0";

in

stdenv.mkDerivation rec {
  version = "${scalaVersion}-${kafkaVersion}";
  name = "apache-kafka-${version}";

  src = fetchurl {
    url = "mirror://apache/kafka/${kafkaVersion}/kafka_${version}.tgz";
    sha256 = "1bya4qs0ccrqibmdivgdxcsyiay4c3vywddrkci1dz9v3ymrqby9";
  };

  buildInputs = [ jre makeWrapper bash ];

  installPhase = ''
    mkdir -p $out
    cp -R config libs $out

    mkdir -p $out/bin
    cp bin/kafka* $out/bin

    # allow us the specify logging directory using env
    substituteInPlace $out/bin/kafka-run-class.sh \
      --replace 'LOG_DIR=$base_dir/logs' 'LOG_DIR=$KAFKA_LOG_DIR'

    for p in $out/bin\/*.sh; do
      wrapProgram $p \
        --set JAVA_HOME "${jre}" \
        --set KAFKA_LOG_DIR "/tmp/apache-kafka-logs" \
        --prefix PATH : "${bash}/bin"
    done
    chmod +x $out/bin\/*
  '';

  meta = with stdenv.lib; {
    homepage = "http://kafka.apache.org";
    description = "A high-throughput distributed messaging system";
    license = licenses.asl20;
    maintainers = [ maintainers.ragge ];
    platforms = platforms.unix;
  };

}

Update apache kafka to version 0.8.2.1

{ stdenv, fetchurl, jre, makeWrapper, bash }:

let
  kafkaVersion = "0.8.2.1";
  scalaVersion = "2.10";

in

stdenv.mkDerivation rec {
  version = "${scalaVersion}-${kafkaVersion}";
  name = "apache-kafka-${version}";

  src = fetchurl {
    url = "mirror://apache/kafka/${kafkaVersion}/kafka_${version}.tgz";
    sha256 = "1klri23fjxbzv7rmi05vcqqfpy7dzi1spn2084y1dxsi1ypfkvc9";
  };

  buildInputs = [ jre makeWrapper bash ];

  installPhase = ''
    mkdir -p $out
    cp -R config libs $out

    mkdir -p $out/bin
    cp bin/kafka* $out/bin

    # allow us the specify logging directory using env
    substituteInPlace $out/bin/kafka-run-class.sh \
      --replace 'LOG_DIR=$base_dir/logs' 'LOG_DIR=$KAFKA_LOG_DIR'

    for p in $out/bin\/*.sh; do
      wrapProgram $p \
        --set JAVA_HOME "${jre}" \
        --set KAFKA_LOG_DIR "/tmp/apache-kafka-logs" \
        --prefix PATH : "${bash}/bin"
    done
    chmod +x $out/bin\/*
  '';

  meta = with stdenv.lib; {
    homepage = "http://kafka.apache.org";
    description = "A high-throughput distributed messaging system";
    license = licenses.asl20;
    maintainers = [ maintainers.ragge ];
    platforms = platforms.unix;
  };

}


{ stdenv, fetchurl, cmake, qt4, pkgconfig, qtkeychain, sqlite }:

stdenv.mkDerivation rec {
  name = "owncloud-client" + "-" + version;

  version = "2.1.1";

  src = fetchurl {
    url = "https://download.owncloud.com/desktop/stable/owncloudclient-${version}.tar.xz";
    sha256 = "4e7cfeb72ec565392e7968f352c4a7f0ef2988cc577ebdfd668a3887d320b1cb";
  };

  buildInputs =
    [ cmake qt4 pkgconfig qtkeychain sqlite];

  #configurePhase = ''
  #  mkdir build
  #  cd build
  #  cmake -DBUILD_WITH_QT4=on \
  #        -DCMAKE_INSTALL_PREFIX=$out \
  #        -DCMAKE_BUILD_TYPE=Release \
  #        ..
  #'';

  enableParallelBuilding = true;

  meta = {
    description = "Synchronise your ownCloud with your computer using this desktop client";
    homepage = https://owncloud.org;
    maintainers = with stdenv.lib.maintainers; [ qknight ];
    meta.platforms = stdenv.lib.platforms.unix;
  };
}

Fix "libocsync.so.0 not found" error

{ stdenv, fetchurl, cmake, qt4, pkgconfig, qtkeychain, sqlite }:

stdenv.mkDerivation rec {
  name = "owncloud-client" + "-" + version;

  version = "2.1.1";

  src = fetchurl {
    url = "https://download.owncloud.com/desktop/stable/owncloudclient-${version}.tar.xz";
    sha256 = "4e7cfeb72ec565392e7968f352c4a7f0ef2988cc577ebdfd668a3887d320b1cb";
  };

  buildInputs =
    [ cmake qt4 pkgconfig qtkeychain sqlite];

  cmakeFlags = [
  "-UCMAKE_INSTALL_LIBDIR"
  ];

  enableParallelBuilding = true;

  meta = {
    description = "Synchronise your ownCloud with your computer using this desktop client";
    homepage = https://owncloud.org;
    maintainers = with stdenv.lib.maintainers; [ qknight ];
    meta.platforms = stdenv.lib.platforms.unix;
  };
}


{ stdenv, lib, fetchurl, extra-cmake-modules
, qtbase, kdeFrameworks
, libatasmart, parted
, utillinux }:

stdenv.mkDerivation rec {
  pname = "kpmcore";
  version = "3.3.0";

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

  buildInputs = [
    qtbase
    libatasmart
    parted # we only need the library

    kdeFrameworks.kio

    utillinux # needs blkid (note that this is not provided by utillinux-compat)
  ];

  nativeBuildInputs = [ extra-cmake-modules ];

  enableParallelBuilding = true;

  meta = with stdenv.lib; {
    maintainers = with lib.maintainers; [ peterhoeg ];
    # The build requires at least Qt 5.14:
    broken = lib.versionOlder qtbase.version "5.14";
  };
}

Use kio directly - from the scope of libsForQt5 used

{ stdenv, lib, fetchurl, extra-cmake-modules
, qtbase, kio
, libatasmart, parted
, utillinux }:

stdenv.mkDerivation rec {
  pname = "kpmcore";
  version = "3.3.0";

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

  buildInputs = [
    qtbase
    libatasmart
    parted # we only need the library

    kio

    utillinux # needs blkid (note that this is not provided by utillinux-compat)
  ];

  nativeBuildInputs = [ extra-cmake-modules ];

  enableParallelBuilding = true;

  meta = with stdenv.lib; {
    maintainers = with lib.maintainers; [ peterhoeg ];
    # The build requires at least Qt 5.14:
    broken = lib.versionOlder qtbase.version "5.14";
  };
}


{ stdenv, fetchurl, fixedPoint ? false }:

let
  version = "1.1";
in
stdenv.mkDerivation rec {
  name = "libopus-${version}";

  src = fetchurl {
    url = "http://downloads.xiph.org/releases/opus/opus-${version}.tar.gz";
    sha256 = "158xprn2086arvdib3vbbygz7z6jqkw2nci7nlywzzwallap0wmr";
  };

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

  doCheck = true;

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

Allow to enable custom modes.

{ stdenv, fetchurl, fixedPoint ? false, withCustomModes ? false }:

let
  version = "1.1";
in
stdenv.mkDerivation rec {
  name = "libopus-${version}";

  src = fetchurl {
    url = "http://downloads.xiph.org/releases/opus/opus-${version}.tar.gz";
    sha256 = "158xprn2086arvdib3vbbygz7z6jqkw2nci7nlywzzwallap0wmr";
  };

  configureFlags = stdenv.lib.optional fixedPoint "--enable-fixed-point"
                ++ stdenv.lib.optional withCustomModes "--enable-custom-modes";

  doCheck = true;

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


{pkgs, config, ...}:

let
  inherit (config.boot) kernelPackages;
  inherit (kernelPackages) kernel;
in

{
  boot = {
    extraModulePackages =
      pkgs.lib.optional
        (!kernel.features ? iwlwifi)
        kernelPackages.iwlwifi;
  };

  services = {
    udev = {
      addFirmware = [ pkgs.iwlwifi4965ucode ];
    };
  };
}

Use the right iwl4965 firmware depending on the kernel version.

{pkgs, config, ...}:

let
  inherit (config.boot) kernelPackages;
  inherit (kernelPackages) kernel;
in

{
  boot = {
    extraModulePackages =
      pkgs.lib.optional
        (!kernel.features ? iwlwifi)
        kernelPackages.iwlwifi;
  };

  services = {
    udev = {
      addFirmware = [ kernelPackages.iwlwifi4965ucode ];
    };
  };
}


let
  defaultPkgs = import <nixpkgs> {};
  pinnedPkgs = import (defaultPkgs.fetchFromGitHub {
    owner = "NixOS";
    repo = "nixpkgs-channels";
    rev = "3a763b91963"; # 11 July 2017
    sha256 = "0q47hjl01wylp6cdb52fyjbbx45djnz7bwfyj2mfv2lh04iph3s8";
  }) {};

in

{ nixpkgs ? pinnedPkgs }:

let
  pkgs = if nixpkgs == null then defaultPkgs else pinnedPkgs;
  devEnv = with pkgs; buildEnv {
    name = "devEnv";
    paths = [
      python2Packages.virtualenv
      terraform_0_10
    ];
  };
in
  pkgs.runCommand "setupEnv" {
    buildInputs = [
      devEnv
    ];
    shellHook = ''
      if [ -e "./aws/aws-env.sh" ]; then
        . ./aws/aws-env.sh
      fi
    '';
  } ""

Add dependencies for running with EC2 instance

let
  defaultPkgs = import <nixpkgs> {};
  pinnedPkgs = import (defaultPkgs.fetchFromGitHub {
    owner = "NixOS";
    repo = "nixpkgs-channels";
    rev = "3a763b91963"; # 11 July 2017
    sha256 = "0q47hjl01wylp6cdb52fyjbbx45djnz7bwfyj2mfv2lh04iph3s8";
  }) {};

in

{ nixpkgs ? pinnedPkgs }:

let
  pkgs = if nixpkgs == null then defaultPkgs else pinnedPkgs;
  devEnv = with pkgs; buildEnv {
    name = "devEnv";
    paths = [
      python2Packages.virtualenv
      terraform_0_10
      wget
    ];
  };
in
  pkgs.runCommand "setupEnv" {
    buildInputs = [
      devEnv
    ];
    shellHook = ''
      unset SOURCE_DATE_EPOCH
      if [ -e "p2" ]; then
        . p2/bin/activate
      fi

      if [ -e "./aws/aws-env.sh" ]; then
        . ./aws/aws-env.sh
      fi
    '';
  } ""


let
  defaultPkgs = import <nixpkgs> {};
  pinnedPkgs = import (defaultPkgs.fetchFromGitHub {
    owner = "NixOS";
    repo = "nixpkgs-channels";
    rev = "f0fac3b578086066b47360de17618448d066b30e"; # 17 April 2017
    sha256 = "1mpwdminwk1wzycwmgi2c2kwpbcfjwmxiakn7bmvvsaxb30gwyyb";
  }) {};

in

{ nixpkgs ? pinnedPkgs }:

let
  pkgs = if nixpkgs == null then defaultPkgs else pinnedPkgs;
  devEnv = with pkgs; buildEnv {
    name = "devEnv";
    paths = [
      awscli
      python
      python3
      pythonPackages.credstash
      packer
    ];
  };
in
  pkgs.runCommand "dummy" {
    buildInputs = [
      devEnv
    ];
  } ""

Remove dependency on python 2

let
  defaultPkgs = import <nixpkgs> {};
  pinnedPkgs = import (defaultPkgs.fetchFromGitHub {
    owner = "NixOS";
    repo = "nixpkgs-channels";
    rev = "f0fac3b578086066b47360de17618448d066b30e"; # 17 April 2017
    sha256 = "1mpwdminwk1wzycwmgi2c2kwpbcfjwmxiakn7bmvvsaxb30gwyyb";
  }) {};

in

{ nixpkgs ? pinnedPkgs }:

let
  pkgs = if nixpkgs == null then defaultPkgs else pinnedPkgs;
  devEnv = with pkgs; buildEnv {
    name = "devEnv";
    paths = [
      awscli
      python3
      pythonPackages.credstash
      packer
    ];
  };
in
  pkgs.runCommand "dummy" {
    buildInputs = [
      devEnv
    ];
  } ""


# given a pakcage with a $name.desktop file, makes a copy
# as autostart item.

{stdenv, lib}:
{ name            # name of the desktop file (without .desktop)
, package         # package where the desktop file resides in
, srcPrefix ? ""  # additional prefix that the desktop file may have in the 'package'
, after ? null
, condition ? null
, phase ? "2"
}:

# the builder requires that
#   $package/share/applications/$name.desktop
# exists as file.

stdenv.mkDerivation {
  name = "autostart-${name}";
  priority = 5;

  buildCommand = ''
    mkdir -p $out/share/autostart
    target=${name}.desktop
    cp ${package}/share/applications/${srcPrefix}${name}.desktop $target
    chmod +rw $target
    echo "X-KDE-autostart-phase=${phase}" >> $target
    ${lib.optionalString (after != null) ''echo "${after}" >> $target''}
    ${lib.optionalString (condition != null) ''echo "${condition}" >> $target''}
    cp $target $out/share/autostart
  '';

  # this will automatically put 'package' in the environment when you
  # put its startup item in there.
  propagatedBuildInputs = [ package ];
}

Use the right path for storing the desktop files

# given a pakcage with a $name.desktop file, makes a copy
# as autostart item.

{stdenv, lib}:
{ name            # name of the desktop file (without .desktop)
, package         # package where the desktop file resides in
, srcPrefix ? ""  # additional prefix that the desktop file may have in the 'package'
, after ? null
, condition ? null
, phase ? "2"
}:

# the builder requires that
#   $package/share/applications/$name.desktop
# exists as file.

stdenv.mkDerivation {
  name = "autostart-${name}";
  priority = 5;

  buildCommand = ''
    mkdir -p $out/etc/xdg/autostart
    target=${name}.desktop
    cp ${package}/share/applications/${srcPrefix}${name}.desktop $target
    chmod +rw $target
    echo "X-KDE-autostart-phase=${phase}" >> $target
    ${lib.optionalString (after != null) ''echo "${after}" >> $target''}
    ${lib.optionalString (condition != null) ''echo "${condition}" >> $target''}
    cp $target $out/etc/xdg/autostart
  '';

  # this will automatically put 'package' in the environment when you
  # put its startup item in there.
  propagatedBuildInputs = [ package ];
}


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

Update stable channel to v24.0.1312.69.

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


# This file is autogenerated from update.sh in the same directory.
{
  dev = {
    version = "24.0.1312.2";
    url = "http://commondatastorage.googleapis.com/chromium-browser-official/chromium-24.0.1312.2.tar.bz2";
    sha256 = "155l6sm76cp2vzmm673dnb0vcz7akrz6xfp6jsmaa1175h0yal6h";
  };
  beta = {
    version = "23.0.1271.60";
    url = "http://commondatastorage.googleapis.com/chromium-browser-official/chromium-23.0.1271.60.tar.bz2";
    sha256 = "1xsa27ay37jls9jiwqn7wfsc4ag02qd316gszb226hp2vhfv6pf2";
  };
  stable = {
    version = "22.0.1229.94";
    url = "http://commondatastorage.googleapis.com/chromium-browser-official/chromium-22.0.1229.94.tar.bz2";
    sha256 = "1bqwlgmn0dm1xvd6v52zf9gjmykgq4fnw7rancbplfpl3rl7xbx0";
  };
}

Update channels to stable v23.0.1271.64.

# This file is autogenerated from update.sh in the same directory.
{
  dev = {
    version = "25.0.1323.1";
    url = "http://commondatastorage.googleapis.com/chromium-browser-official/chromium-25.0.1323.1.tar.bz2";
    sha256 = "1i7ga1qhnjvnw2gynmpmsvvl5pxcb5z9sgldp87d9yalim5sra6s";
  };
  beta = {
    version = "24.0.1312.14";
    url = "http://commondatastorage.googleapis.com/chromium-browser-official/chromium-24.0.1312.14.tar.bz2";
    sha256 = "03w8cg4kqmpj82976ax9x6y275y9gcri4vc11cvfjp6r1issxzk8";
  };
  stable = {
    version = "23.0.1271.64";
    url = "http://commondatastorage.googleapis.com/chromium-browser-official/chromium-23.0.1271.64.tar.bz2";
    sha256 = "1rzz08sgw07nkmvhhgyrkrcxj3z24lxbx0di6ky6jz3lshibp578";
  };
}


{ stdenv, fetchFromGitHub, rustPlatform, Security }:

rustPlatform.buildRustPackage rec {
  pname = "rust-cbindgen";
  version = "0.13.1";

  src = fetchFromGitHub {
    owner = "eqrion";
    repo = "cbindgen";
    rev = "v${version}";
    sha256 = "1x21g66gri6z9bnnfn7zmnf2lwdf5ing76pcmw0ilx4nzpvfhkg0";
  };

  cargoSha256 = "13fbahdih5whll09pfgyb1bjag1f0d0xfwgm2s342bs1krxsrbh3";

  buildInputs = stdenv.lib.optional stdenv.isDarwin Security;

  checkFlags = [
    # https://github.com/eqrion/cbindgen/issues/338
    "--skip test_expand"
  ];

  meta = with stdenv.lib; {
    description = "A project for generating C bindings from Rust code";
    homepage = https://github.com/eqrion/cbindgen;
    license = licenses.mpl20;
    maintainers = with maintainers; [ jtojnar andir ];
  };
}

Revert "Revert "rust-cbindgen: 0.13.1 -> 0.13.2""

{ stdenv, fetchFromGitHub, rustPlatform, Security }:

rustPlatform.buildRustPackage rec {
  pname = "rust-cbindgen";
  version = "0.13.2";

  src = fetchFromGitHub {
    owner = "eqrion";
    repo = "cbindgen";
    rev = "v${version}";
    sha256 = "100ls8p8w6jwcjh3ligly5alg8fzp21aj7b1qbndn9fm0y1nmjam";
  };

  cargoSha256 = "0d9sz46yzh01dx973q10xzw4k7r7ylvg82s5pkp3zpwcin8smaiw";

  buildInputs = stdenv.lib.optional stdenv.isDarwin Security;

  checkFlags = [
    # https://github.com/eqrion/cbindgen/issues/338
    "--skip test_expand"
  ];

  meta = with stdenv.lib; {
    description = "A project for generating C bindings from Rust code";
    homepage = "https://github.com/eqrion/cbindgen";
    license = licenses.mpl20;
    maintainers = with maintainers; [ jtojnar andir ];
  };
}


{stdenv, fetchurl, ocaml, findlib }:

stdenv.mkDerivation {
  name = "ocaml-twt-0.931";

  src = fetchurl {
    url = https://github.com/mlin/twt/archive/v0.931.tar.gz;
    sha256 = "0hbd4zzjwbzlhv6vcn27al236l0d0mg0jfknywdidxdxwnmd3aj2";
  };

  buildInputs = [ ocaml findlib ];

  createFindlibDestdir = true;

  configurePhase = ''
    mkdir $out/bin
  '';

  dontBuild = true;

  installFlags = "PREFIX=$(out)";

  meta = with stdenv.lib; {
    homepage = http://people.csail.mit.edu/mikelin/ocaml+twt/;
    description = "“The Whitespace Thing” for OCaml";
    license = licenses.mit;
    maintainers = [ maintainers.vbgl ];
    platforms = ocaml.meta.platforms;
  };
}

Revert "ocamlPackages.twt: update from 0.93.2 to 0.931"

{stdenv, fetchurl, ocaml, findlib }:

stdenv.mkDerivation {
  name = "ocaml-twt-0.93.2";

  src = fetchurl {
    url = https://github.com/mlin/twt/archive/v0.93.2.tar.gz;
    sha256 = "aec091fbd1e6c4d252cf9664237418b4bc8c7d6b7a17475589be78365397e768";
  };

  buildInputs = [ ocaml findlib ];

  createFindlibDestdir = true;

  configurePhase = ''
    mkdir $out/bin
  '';

  dontBuild = true;

  installFlags = "PREFIX=$(out)";

  meta = with stdenv.lib; {
    homepage = http://people.csail.mit.edu/mikelin/ocaml+twt/;
    description = "“The Whitespace Thing” for OCaml";
    license = licenses.mit;
    maintainers = [ maintainers.vbgl ];
    platforms = ocaml.meta.platforms;
  };
}


{stdenv, fetchurl, libnl, pkgconfig}:

stdenv.mkDerivation rec {
  name = "iw-3.10";

  src = fetchurl {
    url = "https://www.kernel.org/pub/software/network/iw/${name}.tar.xz";
    sha256 = "1sagsrl2s0d3ar3q2yc5qxk2d47zgn551akwcs9f4a5prw9f4vj5";
  };

  buildInputs = [ libnl pkgconfig ];

  preBuild = "
    makeFlagsArray=(PREFIX=$out)
  ";

  meta = {
    description = "Tool to use nl80211";
    homepage = http://wireless.kernel.org/en/users/Documentation/iw;
    license = "BSD";
    maintainers = with stdenv.lib.maintainers; [viric];
    platforms = with stdenv.lib.platforms; linux;
  };
}

Update iw 3.10 -> 3.11

{stdenv, fetchurl, libnl, pkgconfig}:

stdenv.mkDerivation rec {
  name = "iw-3.11";

  src = fetchurl {
    url = "https://www.kernel.org/pub/software/network/iw/${name}.tar.xz";
    sha256 = "1zrh0pjcy0kg6n8wlr34cg3bmi3nj28rhqn5pad23a1170r2f0z9";
  };

  buildInputs = [ libnl pkgconfig ];

  preBuild = "
    makeFlagsArray=(PREFIX=$out)
  ";

  meta = {
    description = "Tool to use nl80211";
    homepage = http://wireless.kernel.org/en/users/Documentation/iw;
    license = "BSD";
    maintainers = with stdenv.lib.maintainers; [viric];
    platforms = with stdenv.lib.platforms; linux;
  };
}


{ lib, stdenv, fetchFromGitHub, fetchpatch, ncurses, pkg-config, cmake }:

stdenv.mkDerivation rec {
  version = "7.0.0";
  pname = "multitail";

  src = fetchFromGitHub {
    owner = "folkertvanheusden";
    repo = pname;
    rev = version;
    sha256 = "sha256-AMW55Bmwn0BsD36qGXI5WmEfydrMBob8NRY3Tyq92vA=";
  };

  nativeBuildInputs = [ pkg-config cmake ];

  buildInputs = [ ncurses ];

  makeFlags = lib.optionals stdenv.isDarwin [ "-f" "makefile.macosx" ];

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

  hardeningDisable = [ "format" ];

  meta = {
    homepage = "https://github.com/halturin/multitail";
    description = "tail on Steroids";
    maintainers = with lib.maintainers; [ matthiasbeyer ];
    platforms = lib.platforms.unix;
    license = lib.licenses.gpl2Plus;
  };
}

Remove makeFlags to let this pkg compile on darwin

{ lib, stdenv, fetchFromGitHub, fetchpatch, ncurses, pkg-config, cmake }:

stdenv.mkDerivation rec {
  version = "7.0.0";
  pname = "multitail";

  src = fetchFromGitHub {
    owner = "folkertvanheusden";
    repo = pname;
    rev = version;
    sha256 = "sha256-AMW55Bmwn0BsD36qGXI5WmEfydrMBob8NRY3Tyq92vA=";
  };

  nativeBuildInputs = [ pkg-config cmake ];

  buildInputs = [ ncurses ];

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

  hardeningDisable = [ "format" ];

  meta = {
    homepage = "https://github.com/halturin/multitail";
    description = "tail on Steroids";
    maintainers = with lib.maintainers; [ matthiasbeyer ];
    platforms = lib.platforms.unix;
    license = lib.licenses.gpl2Plus;
  };
}


{ lib
, python3
, glibcLocales
}:

with python3.pkgs;

buildPythonApplication rec {
  pname = "mycli";
  version = "1.20.1";

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

  propagatedBuildInputs = [
    pymysql configobj sqlparse prompt_toolkit pygments click pycrypto cli-helpers
  ];

  checkInputs = [ pytest mock glibcLocales ];

  checkPhase = ''
    export HOME=.
    export LC_ALL="en_US.UTF-8"

    py.test
  '';

  meta = {
    inherit version;
    description = "Command-line interface for MySQL";
    longDescription = ''
      Rich command-line interface for MySQL with auto-completion and
      syntax highlighting.
    '';
    homepage = http://mycli.net;
    license = lib.licenses.bsd3;
    maintainers = [ lib.maintainers.jojosch ];
  };
}

Add paramiko as a propagated build input

{ lib
, python3
, glibcLocales
}:

with python3.pkgs;

buildPythonApplication rec {
  pname = "mycli";
  version = "1.20.1";

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

  propagatedBuildInputs = [
    paramiko pymysql configobj sqlparse prompt_toolkit pygments click pycrypto cli-helpers
  ];

  checkInputs = [ pytest mock glibcLocales ];

  checkPhase = ''
    export HOME=.
    export LC_ALL="en_US.UTF-8"

    py.test
  '';

  meta = {
    inherit version;
    description = "Command-line interface for MySQL";
    longDescription = ''
      Rich command-line interface for MySQL with auto-completion and
      syntax highlighting.
    '';
    homepage = http://mycli.net;
    license = lib.licenses.bsd3;
    maintainers = [ lib.maintainers.jojosch ];
  };
}


# This file is autogenerated from update.sh in the same directory.
{
  dev = {
    version = "28.0.1500.5";
    url = "http://commondatastorage.googleapis.com/chromium-browser-official/chromium-28.0.1500.5.tar.xz";
    sha256 = "1jpjmqag875bpy4rwvr362nzx0r8ffcrisil9ci2ar6ayjd4lfhd";
  };
  beta = {
    version = "27.0.1453.81";
    url = "http://commondatastorage.googleapis.com/chromium-browser-official/chromium-27.0.1453.81.tar.xz";
    sha256 = "1g4gsrcdrp06hqr25fd9l4snjhibp5pi7pc3wv11fp8gd04cpv9w";
  };
  stable = {
    version = "26.0.1410.63";
    url = "http://commondatastorage.googleapis.com/chromium-browser-official/chromium-26.0.1410.63.tar.xz";
    sha256 = "0gsb0dgk7p04997wlw7swxnnpf5ix9drn0wn07pgsalr8l3zgy3s";
  };
}

Update dev channel to v28.0.1500.11.

# This file is autogenerated from update.sh in the same directory.
{
  dev = {
    version = "28.0.1500.11";
    url = "http://commondatastorage.googleapis.com/chromium-browser-official/chromium-28.0.1500.11.tar.xz";
    sha256 = "1gnm803y7da7n4c3awh77vmsb0f4d8czs9svgqvvwk9bb7d1kc65";
  };
  beta = {
    version = "27.0.1453.81";
    url = "http://commondatastorage.googleapis.com/chromium-browser-official/chromium-27.0.1453.81.tar.xz";
    sha256 = "1g4gsrcdrp06hqr25fd9l4snjhibp5pi7pc3wv11fp8gd04cpv9w";
  };
  stable = {
    version = "26.0.1410.63";
    url = "http://commondatastorage.googleapis.com/chromium-browser-official/chromium-26.0.1410.63.tar.xz";
    sha256 = "0gsb0dgk7p04997wlw7swxnnpf5ix9drn0wn07pgsalr8l3zgy3s";
  };
}


{ stdenv, fetchurl, buildPythonPackage, pythonPackages, python }:

buildPythonPackage rec {
  name = "beets-1.3.6";
  namePrefix = "";

  src = fetchurl {
    url = "http://pypi.python.org/packages/source/b/beets/${name}.tar.gz";
    md5 = "59615a54b3ac3983159e77ff9dda373e";
  };

  # tests depend on $HOME setting
  preConfigure = "export HOME=$TMPDIR";

  propagatedBuildInputs = [
    pythonPackages.pyyaml
    pythonPackages.unidecode
    pythonPackages.mutagen
    pythonPackages.munkres
    pythonPackages.musicbrainzngs
    pythonPackages.enum34
    pythonPackages.pylast
    pythonPackages.rarfile
    pythonPackages.flask
    python.modules.sqlite3
    python.modules.readline
  ];

  buildInputs = with pythonPackages; [ mock pyechonest six responses nose ];

  # 10 tests are failing
  doCheck = false;

  meta = {
    homepage = http://beets.radbox.org;
    description = "Music tagger and library organizer";
    license = stdenv.lib.licenses.mit;
    maintainers = [ stdenv.lib.maintainers.iElectric ];
  };
}

Update to new upstream version 1.3.9.

{ stdenv, fetchurl, buildPythonPackage, pythonPackages, python }:

buildPythonPackage rec {
  name = "beets-1.3.9";
  namePrefix = "";

  src = fetchurl {
    url = "http://pypi.python.org/packages/source/b/beets/${name}.tar.gz";
    md5 = "0211b4abfe7887da22c1413e761fdcb4";
  };

  # tests depend on $HOME setting
  preConfigure = "export HOME=$TMPDIR";

  propagatedBuildInputs = [
    pythonPackages.pyyaml
    pythonPackages.unidecode
    pythonPackages.mutagen
    pythonPackages.munkres
    pythonPackages.musicbrainzngs
    pythonPackages.enum34
    pythonPackages.pylast
    pythonPackages.rarfile
    pythonPackages.flask
    python.modules.sqlite3
    python.modules.readline
  ];

  buildInputs = with pythonPackages; [ mock pyechonest six responses nose ];

  # 10 tests are failing
  doCheck = false;

  meta = {
    homepage = http://beets.radbox.org;
    description = "Music tagger and library organizer";
    license = stdenv.lib.licenses.mit;
    maintainers = [ stdenv.lib.maintainers.iElectric ];
  };
}


{ stdenv, fetchurl, cmake, openblasCompat, superlu, hdf5 }:

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

  src = fetchurl {
    url = "mirror://sourceforge/arma/armadillo-${version}.tar.xz";
    sha256 = "1nxq2jp4jlvinynv0l04rpdzpnkzdsng0d5vi3hilc0hlsjnbnjs";
  };

  nativeBuildInputs = [ cmake ];
  buildInputs = [ openblasCompat superlu hdf5 ];

  cmakeFlags = [ "-DDETECT_HDF5=ON" ];

 patches = [ ./use-unix-config-on-OS-X.patch ];

  meta = with stdenv.lib; {
    description = "C++ linear algebra library";
    homepage = http://arma.sourceforge.net;
    license = licenses.asl20;
    platforms = platforms.unix;
    maintainers = with maintainers; [ juliendehos knedlsepp ];
  };
}

Make use of openBLAS's built-in LAPACK

{ stdenv, fetchurl, cmake, openblasCompat, superlu, hdf5 }:

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

  src = fetchurl {
    url = "mirror://sourceforge/arma/armadillo-${version}.tar.xz";
    sha256 = "1nxq2jp4jlvinynv0l04rpdzpnkzdsng0d5vi3hilc0hlsjnbnjs";
  };

  nativeBuildInputs = [ cmake ];
  buildInputs = [ openblasCompat superlu hdf5 ];

  cmakeFlags = let
    libSuff = if stdenv.isDarwin then "dylib" else "so";
  in [
    "-DLAPACK_LIBRARY=${openblasCompat}/lib/libopenblas.${libSuff}"
    "-DDETECT_HDF5=ON"
  ];

  patches = [ ./use-unix-config-on-OS-X.patch ];

  meta = with stdenv.lib; {
    description = "C++ linear algebra library";
    homepage = http://arma.sourceforge.net;
    license = licenses.asl20;
    platforms = platforms.unix;
    maintainers = with maintainers; [ juliendehos knedlsepp ];
  };
}


{ stdenv, version, src
, autoreconfHook, zlib, gtest
, ...
}:

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

  inherit src;

  postPatch = ''
    rm -rf gtest
    cp -r ${gtest.source} gtest
    chmod -R a+w gtest
  '';

  buildInputs = [ autoreconfHook zlib ];

  doCheck = true;

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

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

    license = "mBSD";

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

  passthru.version = version;
}

Remove v as it is unneeded now

{ stdenv, version, src
, autoreconfHook, zlib, gtest
, ...
}:

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

  inherit src;

  postPatch = ''
    rm -rf gtest
    cp -r ${gtest.source} gtest
    chmod -R a+w gtest
  '';

  buildInputs = [ autoreconfHook zlib ];

  doCheck = true;

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

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

    license = "mBSD";

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

  passthru.version = version;
}


{ symlinkJoin, makeWrapper, kakoune, plugins ? [], configure ? {} }:

let
  # "plugins" is the preferred way, but some configurations may be
  # using "configure.plugins", so accept both
  requestedPlugins = plugins ++ (configure.plugins or []);

in
  symlinkJoin {
    name = "kakoune-${kakoune.version}";

    buildInputs = [ makeWrapper ];

    paths = [ kakoune ] ++ requestedPlugins;

    postBuild = ''
      # location of kak binary is used to find ../share/kak/autoload,
      # unless explicitly overriden with KAKOUNE_RUNTIME
      rm "$out/bin/kak"
      makeWrapper "${kakoune}/bin/kak" "$out/bin/kak" --set KAKOUNE_RUNTIME "$out/share/kak"
    '';

    meta = kakoune.meta // { priority = (kakoune.meta.priority or 0) - 1; };
  }

Fix :doc when using plugins

{ symlinkJoin, makeWrapper, kakoune, plugins ? [], configure ? {} }:

let
  # "plugins" is the preferred way, but some configurations may be
  # using "configure.plugins", so accept both
  requestedPlugins = plugins ++ (configure.plugins or []);

in
  symlinkJoin {
    name = "kakoune-${kakoune.version}";

    buildInputs = [ makeWrapper ];

    paths = [ kakoune ] ++ requestedPlugins;

    postBuild = ''
      # location of kak binary is used to find ../share/kak/autoload,
      # unless explicitly overriden with KAKOUNE_RUNTIME
      rm "$out/bin/kak"
      makeWrapper "${kakoune}/bin/kak" "$out/bin/kak" --set KAKOUNE_RUNTIME "$out/share/kak"

      # currently kakoune ignores doc files if they are symlinks, so workaround by
      # copying doc files over, so they become regular files...
      mkdir "$out/DELETE_ME"
      mv "$out/share/kak/doc" "$out/DELETE_ME"
      cp -r --dereference "$out/DELETE_ME/doc" "$out/share/kak"
      rm -Rf "$out/DELETE_ME"
    '';

    meta = kakoune.meta // { priority = (kakoune.meta.priority or 0) - 1; };
  }


{ stdenv, fetchurl, boost, cmake, gdal, libgeotiff, libtiff, LASzip, fixDarwinDylibNames }:

stdenv.mkDerivation rec {
  name = "libLAS-1.8.1";

  src = fetchurl {

    url = "http://download.osgeo.org/liblas/${name}.tar.bz2";
    sha256 = "0xjfxb3ydvr2258ji3spzyf81g9caap19ql2pk91wiivqsc4mnws";
  };

  buildInputs = [ boost cmake gdal libgeotiff libtiff LASzip ]
                ++ stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames;

  cmakeFlags = [
    "-DGDAL_CONFIG=${gdal}/bin/gdal-config"
  ];

  postFixup = stdenv.lib.optionalString stdenv.isDarwin ''
    install_name_tool -change "@rpath/liblas.3.dylib" "$out/lib/liblas.3.dylib" $out/lib/liblas_c.dylib
  '';

  meta = {
    description = "LAS 1.0/1.1/1.2 ASPRS LiDAR data translation toolset";
    homepage = http://www.liblas.org;
    license = stdenv.lib.licenses.bsd3;
    platforms = stdenv.lib.platforms.unix;
    maintainers = [ stdenv.lib.maintainers.michelk ];
  };
}

Build libLAS with LASzip support

{ stdenv, fetchurl, boost, cmake, gdal, libgeotiff, libtiff, LASzip, fixDarwinDylibNames }:

stdenv.mkDerivation rec {
  name = "libLAS-1.8.1";

  src = fetchurl {

    url = "http://download.osgeo.org/liblas/${name}.tar.bz2";
    sha256 = "0xjfxb3ydvr2258ji3spzyf81g9caap19ql2pk91wiivqsc4mnws";
  };

  buildInputs = [ boost cmake gdal libgeotiff libtiff LASzip ]
                ++ stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames;

  cmakeFlags = [
    "-DGDAL_CONFIG=${gdal}/bin/gdal-config"
    "-DWITH_LASZIP=ON"
    "-DLASZIP_INCLUDE_DIR=${LASzip}/include"
  ];

  postFixup = stdenv.lib.optionalString stdenv.isDarwin ''
    install_name_tool -change "@rpath/liblas.3.dylib" "$out/lib/liblas.3.dylib" $out/lib/liblas_c.dylib
  '';

  meta = {
    description = "LAS 1.0/1.1/1.2 ASPRS LiDAR data translation toolset";
    homepage = http://www.liblas.org;
    license = stdenv.lib.licenses.bsd3;
    platforms = stdenv.lib.platforms.unix;
    maintainers = [ stdenv.lib.maintainers.michelk ];
  };
}


{ stdenv, fetchurl, flex, bison
, enableStatic ? false
}:

stdenv.mkDerivation rec {
  name = "libpcap-1.7.4";

  src = fetchurl {
    url = "http://www.tcpdump.org/release/${name}.tar.gz";
    sha256 = "1c28ykkizd7jqgzrfkg7ivqjlqs9p6lygp26bsw2i0z8hwhi3lvs";
  };

  nativeBuildInputs = [ flex bison ];

  # We need to force the autodetection because detection doesn't
  # work in pure build enviroments.
  configureFlags =
    (if stdenv.isLinux then [ "--with-pcap=linux" ]
     else if stdenv.isDarwin then [ "--with-pcap=bpf" ]
     else [])
    ++ stdenv.lib.optional enableStatic "--enable-static";

  prePatch = stdenv.lib.optionalString stdenv.isDarwin ''
    substituteInPlace configure --replace " -arch i386" ""
  '';

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

  crossAttrs = {
    # Stripping hurts in static libraries
    dontStrip = true;
    configureFlags = configureFlags ++ [ "ac_cv_linux_vers=2" ];
  };

  meta = {
    homepage = http://www.tcpdump.org;
    description = "Packet Capture Library";
  };
}

Revert "libpcap: support static build"

{ stdenv, fetchurl, flex, bison }:

stdenv.mkDerivation rec {
  name = "libpcap-1.7.4";

  src = fetchurl {
    url = "http://www.tcpdump.org/release/${name}.tar.gz";
    sha256 = "1c28ykkizd7jqgzrfkg7ivqjlqs9p6lygp26bsw2i0z8hwhi3lvs";
  };

  nativeBuildInputs = [ flex bison ];

  # We need to force the autodetection because detection doesn't
  # work in pure build enviroments.
  configureFlags =
    if stdenv.isLinux then [ "--with-pcap=linux" ]
    else if stdenv.isDarwin then [ "--with-pcap=bpf" ]
    else [];

  prePatch = stdenv.lib.optionalString stdenv.isDarwin ''
    substituteInPlace configure --replace " -arch i386" ""
  '';

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

  crossAttrs = {
    # Stripping hurts in static libraries
    dontStrip = true;
    configureFlags = configureFlags ++ [ "ac_cv_linux_vers=2" ];
  };

  meta = {
    homepage = http://www.tcpdump.org;
    description = "Packet Capture Library";
  };
}


{ stdenv, fetchFromGitHub, pythonPackages }:

pythonPackages.buildPythonApplication rec {
  name = "beets-alternatives-${version}";
  version = "0.8.2";

  src = fetchFromGitHub {
    repo = "beets-alternatives";
    owner = "geigerzaehler";
    rev = "v${version}";
    sha256 = "10za6h59pxa13y8i4amqhc6392csml0dl771lssv6b6a98kamsy7";
  };

  postPatch = ''
    sed -i -e '/install_requires/,/\]/{/beets/d}' setup.py
  '';

  propagatedBuildInputs = with pythonPackages; [ futures ];

  meta = {
    description = "Beets plugin to manage external files";
    homepage = https://github.com/geigerzaehler/beets-alternatives;
    license = stdenv.lib.licenses.mit;
  };
}

Disable test suite for now

{ stdenv, fetchFromGitHub, pythonPackages }:

pythonPackages.buildPythonApplication rec {
  name = "beets-alternatives-${version}";
  version = "0.8.2";

  src = fetchFromGitHub {
    repo = "beets-alternatives";
    owner = "geigerzaehler";
    rev = "v${version}";
    sha256 = "10za6h59pxa13y8i4amqhc6392csml0dl771lssv6b6a98kamsy7";
  };

  postPatch = ''
    sed -i -e '/install_requires/,/\]/{/beets/d}' setup.py
    sed -i -e '/test_suite/d' setup.py
  '';

  propagatedBuildInputs = with pythonPackages; [ futures ];

  meta = {
    description = "Beets plugin to manage external files";
    homepage = https://github.com/geigerzaehler/beets-alternatives;
    license = stdenv.lib.licenses.mit;
  };
}


# This package is only used to create the documentation of zsh-cvs
# eg have a look at http://www.zsh.org/mla/users/2008/msg00715.html
# latest release is newer though
args: with args;
stdenv.mkDerivation {
  name = "yodl-2.13.2";

  buildInputs = [perl];

  src = fetchurl {
    url = "mirror://sourceforge/sourceforge/yodl/yodl_2.13.2.orig.tar.gz";
    sha256 = "07zzyx8vf27y3p549qza0pqrb61hfh0gynxqb8i1cghjmxhrlxj3";
  };
  # maybe apply diff?

  # This doesn't isntall docs yet, do you need them?
  installPhase = ''
    # -> $out
    sed -i "s@'/usr/@'$out/@" contrib/build.pl
    perl contrib/build.pl make-software
    perl contrib/build.pl install-software
  '';
}

Update yodl sources. Unofrtunately, old ones are unavailable. Icmake is still needed to build yodl

# This package is only used to create the documentation of zsh-cvs
# eg have a look at http://www.zsh.org/mla/users/2008/msg00715.html
# latest release is newer though
args: with args;
stdenv.mkDerivation {
  name = "yodl-2.14.3";

  buildInputs = [perl];

  src = fetchurl {
    url = "mirror://sourceforge/yodl/yodl_2.14.3.orig.tar.gz";
    sha256 = "0paypm76p34hap3d18vvks5rrilchcw6q56rvq6pjf9raqw8ynd4";
  };
  patches = [(fetchurl {
    url = "mirror://sourceforge/yodl/yodl_2.14.3-1.diff.gz";
    sha256 = "176hlbiidv7p9051f04anzj4sr9dwlp9439f9mjvvgks47ac0qx4";
  })];

  # This doesn't isntall docs yet, do you need them?
  installPhase = ''
    # -> $out
    sed -i "s@'/usr/@'$out/@" contrib/build.pl
    perl contrib/build.pl make-software
    perl contrib/build.pl install-software
  '';
}


{stdenv, fetchurl, libtool, gettext}:

stdenv.mkDerivation rec {
  name = "attr-2.4.44";

  src = fetchurl {
    url = "mirror://savannah/attr/${name}.src.tar.gz";
    sha256 = "16244r2vrd57i5fnf7dz3yi2mcckc47jr9y539jvljrzwnw18qlz";
  };

  buildNativeInputs = [gettext];
  buildInputs = [libtool];

  configureFlags = "MAKE=make LIBTOOL=libtool MSGFMT=msgfmt MSGMERGE=msgmerge XGETTEXT=xgettext ECHO=echo SED=sed AWK=gawk";

  installTargets = "install install-lib install-dev";

  meta = {
    homepage = http://savannah.nongnu.org/projects/attr/;
    description = "Library and tools for manipulating extended attributes";
  };
}

Remove unnecessary dependency on Libtool.

{ stdenv, fetchurl, gettext }:

stdenv.mkDerivation rec {
  name = "attr-2.4.44";

  src = fetchurl {
    url = "mirror://savannah/attr/${name}.src.tar.gz";
    sha256 = "16244r2vrd57i5fnf7dz3yi2mcckc47jr9y539jvljrzwnw18qlz";
  };

  buildNativeInputs = [gettext];

  configureFlags = "MAKE=make MSGFMT=msgfmt MSGMERGE=msgmerge XGETTEXT=xgettext ECHO=echo SED=sed AWK=gawk";

  installTargets = "install install-lib install-dev";

  meta = {
    homepage = http://savannah.nongnu.org/projects/attr/;
    description = "Library and tools for manipulating extended attributes";
  };
}


{ stdenv, fetchurl }:

stdenv.mkDerivation rec {
  name = "man-pages-3.75";

  src = fetchurl {
    url = "mirror://kernel/linux/docs/man-pages/${name}.tar.xz";
    sha256 = "1xnja13a3zb7gzcsdn7sx962lk6mj8m3rz1w7fpgvhsq745cmah6";
  };

  preBuild =
    ''
      makeFlagsArray=(MANDIR=$out/share/man)
    '';

  meta = {
    description = "Linux development manual pages";
    homepage = http://www.kernel.org/doc/man-pages/;
    repositories.git = http://git.kernel.org/pub/scm/docs/man-pages/man-pages;
  };
}

Update (kernel) manpages 3.75 -> 3.78

{ stdenv, fetchurl }:

stdenv.mkDerivation rec {
  name = "man-pages-3.78";

  src = fetchurl {
    url = "mirror://kernel/linux/docs/man-pages/${name}.tar.xz";
    sha256 = "0zm3sc0zbfng440jjqha8qnzivvg5nqpwgi7zv9h8qxwgyhrfa65";
  };

  preBuild =
    ''
      makeFlagsArray=(MANDIR=$out/share/man)
    '';

  meta = {
    description = "Linux development manual pages";
    homepage = http://www.kernel.org/doc/man-pages/;
    repositories.git = http://git.kernel.org/pub/scm/docs/man-pages/man-pages;
  };
}


{
  network.description = "NixOS EBS creator";

  machine =
    { config, pkgs, resources, ... }:
    { deployment.targetEnv = "ec2";
      deployment.ec2.instanceType = "m1.large";
      deployment.ec2.securityGroups = [ "admin" ];
      deployment.ec2.ebsBoot = false;
      deployment.ec2.keyPair = resources.ec2KeyPairs.keypair.name;
      environment.systemPackages = [ pkgs.parted ];
    };
}

Use HVM instance for EBS creator, guarantees everything is created in the correct zone.

{
  network.description = "NixOS EBS creator";

  machine =
    { config, pkgs, resources, ... }:
    { deployment.targetEnv = "ec2";
      deployment.ec2.instanceType = "c3.large";
      deployment.ec2.securityGroups = [ "admin" ];
      deployment.ec2.ebsBoot = false;
      deployment.ec2.keyPair = resources.ec2KeyPairs.keypair.name;
      environment.systemPackages = [ pkgs.parted ];
    };
}


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

with lib;

{

  ###### interface

  options = {

    hardware.bluetooth.enable = mkOption {
      type = types.bool;
      default = false;
      description = "Whether to enable support for Bluetooth.";
    };

  };

  ###### implementation

  config = mkIf config.hardware.bluetooth.enable {

    environment.systemPackages = [ pkgs.bluez pkgs.openobex pkgs.obexftp ];

    services.udev.packages = [ pkgs.bluez ];

    services.dbus.packages = [ pkgs.bluez ];

    systemd.services."dbus-org.bluez" = {
      description = "Bluetooth Service";
      serviceConfig = {
        Type = "dbus";
        BusName = "org.bluez";
        ExecStart = "${pkgs.bluez}/sbin/bluetoothd -n";
      };
      wantedBy = [ "bluetooth.target" ];
    };

  };

}

Remove bluez from the system path when enabling the service

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

with lib;

{

  ###### interface

  options = {

    hardware.bluetooth.enable = mkOption {
      type = types.bool;
      default = false;
      description = "Whether to enable support for Bluetooth.";
    };

  };

  ###### implementation

  config = mkIf config.hardware.bluetooth.enable {

    services.udev.packages = [ pkgs.bluez ];

    services.dbus.packages = [ pkgs.bluez ];

    systemd.services."dbus-org.bluez" = {
      description = "Bluetooth Service";
      serviceConfig = {
        Type = "dbus";
        BusName = "org.bluez";
        ExecStart = "${pkgs.bluez}/sbin/bluetoothd -n";
      };
      wantedBy = [ "bluetooth.target" ];
    };

  };

}


{
  enable = true;
  provider = "manual";
  #provider = "geoclue2";
  # South of New York, for less seasonal variation
  latitude = "27";
  longitude = "-74.0060"; # New York
  #longitude = "-122.4194"; # San Francisco
  temperature.night = 1500;
}

Add another city commented out for gammashift

{
  enable = true;
  provider = "manual";
  #provider = "geoclue2";
  # South of New York, for less seasonal variation
  latitude = "27";
  #longitude = "0.0"; # London
  longitude = "-74.0060"; # New York
  #longitude = "-122.4194"; # San Francisco
  temperature.night = 1500;
}


{ stdenv, fetchurl, qt, popplerQt4, phonon }:

stdenv.mkDerivation rec {
  pname = "texstudio";
  version = "2.7.0";
  name = "${pname}-${version}";
  altname="Texstudio";

  src = fetchurl {
    url = "mirror://sourceforge/texstudio/${altname} ${version}/${name}.tar.gz";
    sha1 = "0a5960689f2f9daef93391b96321ccc8c2e94c38";
  };

  buildInputs = [ qt popplerQt4 phonon ];

  preConfigure = "qmake -r PREFIX=$out";

  meta = with stdenv.lib; {
    description = "Fork of TeXMaker, this editor is a full fledged IDE for LaTeX editing with completion, structure viewer, preview and support of any compilation chain.";
    homepage = "http://texstudio.sourceforge.net/";
    license = licenses.gpl2Plus;
    platforms = platforms.linux;
  };
}

Add the necessary preConfigure so that TeXstudio compile (find poppler-qt4.h)

{ stdenv, fetchurl, qt, popplerQt4, zlib}:

stdenv.mkDerivation rec {
  pname = "texstudio";
  version = "2.7.0";
  name = "${pname}-${version}";
  altname="Texstudio";

  src = fetchurl {
    url = "mirror://sourceforge/texstudio/${name}.tar.gz";
    sha256 = "167d78nfk265jjvl129nr70v8ladb2rav2qyhw7ngr6m54gak831";
  };

  buildInputs = [ qt popplerQt4 zlib ];

  preConfigure = ''
    export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I$(echo ${popplerQt4}/include/poppler/qt4) "
    qmake PREFIX=$out texstudio.pro
  '';

  meta = with stdenv.lib; {
    description = "Fork of TeXMaker, this editor is a full fledged IDE for LaTeX editing with completion, structure viewer, preview and support of any compilation chain.";
    homepage = "http://texstudio.sourceforge.net/";
    license = licenses.gpl2Plus;
    platforms = platforms.linux;
  };
}


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

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

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

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

Add oh-my-zsh plugin for nix-shell declaratively

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

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

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

  xdg.configFile."alacritty/alacritty.yml".source = ../programs/alacritty.yml;
  xdg.configFile."oh-my-zsh/plugins/nix-shell".source = pkgs.fetchFromGitHub {
    owner = "chisui";
    repo = "zsh-nix-shell";
    rev = "f8574f27e1d7772629c9509b2116d504798fe30a";
    sha256 = "0svskd09vvbzqk2ziw6iaz1md25xrva6s6dhjfb471nqb13brmjq";
  };
}


{ stdenv, fetchFromGitHub, ncurses }:
stdenv.mkDerivation rec {

  version = "3.2.6";

  name = "mp3blaster-${version}";

  src = fetchFromGitHub {
    owner = "stragulus";
    repo = "mp3blaster";
    rev = "v${version}";
    sha256 = "0pzwml3yhysn8vyffw9q9p9rs8gixqkmg4n715vm23ib6wxbliqs";
  };

  buildInputs = [ ncurses ];

  buildFlags = [ "CXXFLAGS=-Wno-narrowing" ];

  meta = with stdenv.lib; {
    description = "An audio player for the text console";
    homepage = http://www.mp3blaster.org/;
    license = licenses.gpl2;
    maintainers = with maintainers; [ earldouglas ];
    platforms = platforms.all;
  };

}

Build with support for ogg vorbis

{ stdenv, fetchFromGitHub, ncurses, libvorbis }:
stdenv.mkDerivation rec {

  version = "3.2.6";

  name = "mp3blaster-${version}";

  src = fetchFromGitHub {
    owner = "stragulus";
    repo = "mp3blaster";
    rev = "v${version}";
    sha256 = "0pzwml3yhysn8vyffw9q9p9rs8gixqkmg4n715vm23ib6wxbliqs";
  };

  buildInputs = [
    ncurses
    libvorbis
  ];

  buildFlags = [ "CXXFLAGS=-Wno-narrowing" ];

  meta = with stdenv.lib; {
    description = "An audio player for the text console";
    homepage = http://www.mp3blaster.org/;
    license = licenses.gpl2;
    maintainers = with maintainers; [ earldouglas ];
    platforms = platforms.all;
  };

}


{ stdenv, fetchurl, cmake, zlib, sqlite, gmp, libffi, cairo, ncurses,
  freetype, mesa, libpng, libtiff, libjpeg, readline, libsndfile, libxml2,
  freeglut, libsamplerate, pcre, libevent, libedit, yajl,
  python, openssl, glfw
}:

stdenv.mkDerivation {
  name = "io-2011.09.12";
  src = fetchurl {
    url = http://github.com/stevedekorte/io/tarball/2011.09.12;
    name = "io-2011.09.12.tar.gz";
    sha256 = "14nhk5vkk74pbf36jsfaxqh2ihi5d7jby79yf1ibbax319xbjk3v";
  };

  buildInputs = [
    cmake zlib sqlite gmp libffi cairo ncurses freetype mesa
    libpng libtiff libjpeg readline libsndfile libxml2
    freeglut libsamplerate pcre libevent libedit yajl
  ];

  cmakeFlags = [ "-DCMAKE_BUILD_TYPE=release" ];

  meta = {
    description = "Io programming language";
    maintainers = with stdenv.lib.maintainers; [
      raskin
      z77z
    ];
    platforms = stdenv.lib.platforms.linux;
  };
}

Update Io lang to version 2013.12.04

{ stdenv, fetchurl, cmake, zlib, sqlite, gmp, libffi, cairo, ncurses,
  freetype, mesa, libpng, libtiff, libjpeg, readline, libsndfile, libxml2,
  freeglut, libsamplerate, pcre, libevent, libedit, yajl,
  python, openssl, glfw
}:

stdenv.mkDerivation {
  name = "io-2013.12.04";
  src = fetchurl {
    url = http://github.com/stevedekorte/io/tarball/2013.12.04;
    name = "io-2013.12.04.tar.gz";
    sha256 = "0kvwr32xdpcr32rnv301xr5l89185dsisbj4v465m68isas0gjm5";
  };

  buildInputs = [
    cmake zlib sqlite gmp libffi cairo ncurses freetype mesa
    libpng libtiff libjpeg readline libsndfile libxml2
    freeglut libsamplerate pcre libevent libedit yajl
  ];

  cmakeFlags = [ "-DCMAKE_BUILD_TYPE=release" ];

  meta = {
    description = "Io programming language";
    maintainers = with stdenv.lib.maintainers; [
      raskin
      z77z
    ];
    platforms = stdenv.lib.platforms.linux;
  };
}


{ stdenv, lib, fetchFromGitHub, cmake }:

stdenv.mkDerivation rec {
  pname = "cgreen";
  version = "1.4.1";

  src = fetchFromGitHub {
    owner = "cgreen-devs";
    repo = "cgreen";
    rev = version;
    sha256 = "sha256-aQrfsiPuNrEMscZrOoONiN665KlNmnOiYj9ZIyzW304=";
  };

  nativeBuildInputs = [ cmake ];

  meta = with lib; {
    homepage = "https://github.com/cgreen-devs/cgreen";
    description = "The Modern Unit Test and Mocking Framework for C and C++";
    license = licenses.isc;
    maintainers = [ maintainers.nichtsfrei ];
    platforms = platforms.unix;
  };
}

Fix some uses of /usr/bin

{ stdenv, lib, fetchFromGitHub, cmake }:

stdenv.mkDerivation rec {
  pname = "cgreen";
  version = "1.4.1";

  src = fetchFromGitHub {
    owner = "cgreen-devs";
    repo = "cgreen";
    rev = version;
    sha256 = "sha256-aQrfsiPuNrEMscZrOoONiN665KlNmnOiYj9ZIyzW304=";
  };

  postPatch = ''
    for F in tools/discoverer_acceptance_tests.c tools/discoverer.c; do
      substituteInPlace "$F" --replace "/usr/bin/nm" "nm"
    done
  '';

  nativeBuildInputs = [ cmake ];

  meta = with lib; {
    homepage = "https://github.com/cgreen-devs/cgreen";
    description = "The Modern Unit Test and Mocking Framework for C and C++";
    license = licenses.isc;
    maintainers = [ maintainers.nichtsfrei ];
    platforms = platforms.unix;
  };
}


{ stdenv, fetchurl, autoconf, vala, pkgconfig, glib, gobjectIntrospection }:

stdenv.mkDerivation rec {
  name = "libgee-0.13.4";

  src = fetchurl {
    url = "https://download.gnome.org/sources/libgee/0.13/${name}.tar.xz";
    sha256 = "1gzyx8gy5m6r8km3xbb1kszz0v3p9vsbzwb78pf3fw122gwbjj4k";
  };

  patches = [ ./fix_introspection_paths.patch ];

  buildInputs = [ autoconf vala pkgconfig glib gobjectIntrospection ];

  meta = with stdenv.lib; {
    platforms = platforms.linux;
  };
}

Update to 0.13.90 and enable checks

{ stdenv, fetchurl, autoconf, vala, pkgconfig, glib, gobjectIntrospection }:

stdenv.mkDerivation rec {
  name = "libgee-0.13.90";

  src = fetchurl {
    url = "https://download.gnome.org/sources/libgee/0.13/${name}.tar.xz";
    sha256 = "9496f8fb249f7850db32b50e8675998db8b5276d4568cbf043faa7e745d7b7d6";
  };

  doCheck = true;

  patches = [ ./fix_introspection_paths.patch ];

  buildInputs = [ autoconf vala pkgconfig glib gobjectIntrospection ];

  meta = with stdenv.lib; {
    platforms = platforms.linux;
  };
}


{ stdenv, fetchurl, devicemapper, libgcrypt, libuuid, pkgconfig, popt
, enablePython ? false, python ? null
}:

assert enablePython -> python != null;

stdenv.mkDerivation rec {
  name = "cryptsetup-1.6.7";

  src = fetchurl {
    url = "mirror://kernel/linux/utils/cryptsetup/v1.6/${name}.tar.xz";
    sha256 = "0878vwblazms1dac2ds7vyz8pgi1aac8870ccnl2s0v2sv428g62";
  };

  configureFlags = [ "--enable-cryptsetup-reencrypt" ]
                ++ stdenv.lib.optional enablePython "--enable-python";

  buildInputs = [ devicemapper libgcrypt libuuid pkgconfig popt ]
             ++ stdenv.lib.optional enablePython python;

  meta = {
    homepage = http://code.google.com/p/cryptsetup/;
    description = "LUKS for dm-crypt";
    license = stdenv.lib.licenses.gpl2;
    maintainers = with stdenv.lib.maintainers; [ viric chaoflow ];
    platforms = with stdenv.lib.platforms; linux;
  };
}

Use openssl instead of libgcrypt

{ stdenv, fetchurl, devicemapper, openssl, libuuid, pkgconfig, popt
, enablePython ? false, python ? null
}:

assert enablePython -> python != null;

stdenv.mkDerivation rec {
  name = "cryptsetup-1.6.7";

  src = fetchurl {
    url = "mirror://kernel/linux/utils/cryptsetup/v1.6/${name}.tar.xz";
    sha256 = "0878vwblazms1dac2ds7vyz8pgi1aac8870ccnl2s0v2sv428g62";
  };

  configureFlags = [ "--enable-cryptsetup-reencrypt" "--with-crypto_backend=openssl" ]
                ++ stdenv.lib.optional enablePython "--enable-python";

  buildInputs = [ devicemapper openssl libuuid pkgconfig popt ]
             ++ stdenv.lib.optional enablePython python;

  meta = {
    homepage = http://code.google.com/p/cryptsetup/;
    description = "LUKS for dm-crypt";
    license = stdenv.lib.licenses.gpl2;
    maintainers = with stdenv.lib.maintainers; [ viric chaoflow ];
    platforms = with stdenv.lib.platforms; linux;
  };
}


let
  _pkgs = import <nixpkgs> {};
in
{ pkgs ? import (_pkgs.fetchFromGitHub { owner = "NixOS";
                                         repo = "nixpkgs-channels";
                                         rev = "fd3d2b1a8dca6a4a90093a54cecbdb3e66f163fb";
                                         sha256 = "06cj963b59l29vzsk4d0g89v4kjg4ycgvbgz135yyqfrnn5hlhzn";
                                       }) {}
}:
# FIXME(vdemeester): pin nixpkgs version
pkgs.stdenv.mkDerivation rec {
    name = "docker-volume-ipfs-dev";
    env = pkgs.buildEnv { name = name; paths = buildInputs; };
    buildInputs = [
        pkgs.vndr
        pkgs.go_1_7
        pkgs.gnumake
    ];
}

Add docker and ipfs as dependencies 🐻

let
  _pkgs = import <nixpkgs> {};
in
{ pkgs ? import (_pkgs.fetchFromGitHub { owner = "NixOS";
                                         repo = "nixpkgs-channels";
                                         rev = "fd3d2b1a8dca6a4a90093a54cecbdb3e66f163fb";
                                         sha256 = "06cj963b59l29vzsk4d0g89v4kjg4ycgvbgz135yyqfrnn5hlhzn";
                                       }) {}
}:
# FIXME(vdemeester): pin nixpkgs version
pkgs.stdenv.mkDerivation rec {
    name = "docker-volume-ipfs-dev";
    env = pkgs.buildEnv { name = name; paths = buildInputs; };
    buildInputs = [
        pkgs.vndr
        pkgs.go_1_7
        pkgs.gnumake
	pkgs.ipfs
	pkgs.docker
    ];
}


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

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

stdenv.mkDerivation {
  name = "ocaml-pcre-${version}";

  src = fetchurl {
    url = "http://www.ocaml.info/ocaml_sources/pcre-ocaml-${version}.tar.gz";
    sha256 = "ff41006901f5b2d06a455ec48230eb34375f2eeb8240c341e81ebba0342ee331";
  };

  buildInputs = [ocaml findlib];
  propagatedBuildInputs = [pcre];

  createFindlibDestdir = true;

  configurePhase = "true";	# Skip configure phase

  meta = {
    homepage = "http://www.ocaml.info/home/ocaml_sources.html";
    description = "An efficient C-library for pattern matching with Perl-style regular expressions in OCaml";
    license = "LGPL";
    platforms = ocaml.meta.platforms;
    maintainers = [
      stdenv.lib.maintainers.z77z
    ];
  };
}

Update download link for pcre-ocaml

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

stdenv.mkDerivation {
  name = "ocaml-pcre-6.2.5";

  src = fetchurl {
    url = https://bitbucket.org/mmottl/pcre-ocaml/downloads/pcre-ocaml-6.2.5.tar.gz;
    sha256 = "0iwfi0wmw3xbx31ri96pmrsmmn4r3h9f0k6gyk8j4pajlhl40xzi";
  };

  buildInputs = [ocaml findlib];
  propagatedBuildInputs = [pcre];

  createFindlibDestdir = true;

  configurePhase = "true";	# Skip configure phase

  meta = {
    homepage = "http://www.ocaml.info/home/ocaml_sources.html";
    description = "An efficient C-library for pattern matching with Perl-style regular expressions in OCaml";
    license = "LGPL";
    platforms = ocaml.meta.platforms;
    maintainers = [
      stdenv.lib.maintainers.z77z
    ];
  };
}


{ stdenv, fetchurl, compat24 ? false, compat26 ? true, unicode ? true,
, hostPlatform
}:

assert hostPlatform.isWindows;

stdenv.mkDerivation {
  name = "wxMSW-2.8.11";

  src = fetchurl {
    url = mirror://sourceforge/wxwindows/wxWidgets-2.8.11.tar.gz;
    sha256 = "0icxd21g18d42n1ygshkpw0jnflm03iqki6r623pb5hhd7fm2ksj";
  };

  configureFlags = [
    (if compat24 then "--enable-compat24" else "--disable-compat24")
    (if compat26 then "--enable-compat26" else "--disable-compat26")
    "--disable-precomp-headers"
    (if unicode then "--enable-unicode" else "")
    "--with-opengl"
  ];

  preConfigure = "
    substituteInPlace configure --replace /usr /no-such-path
  ";

  postBuild = "(cd contrib/src && make)";

  postInstall = "
    (cd contrib/src && make install)
    (cd $out/include && ln -s wx-*/* .)
  ";

  passthru = {inherit compat24 compat26 unicode;};
}

Fix syntax --- travis eval did not catch

{ stdenv, fetchurl, compat24 ? false, compat26 ? true, unicode ? true
, hostPlatform
}:

assert hostPlatform.isWindows;

stdenv.mkDerivation {
  name = "wxMSW-2.8.11";

  src = fetchurl {
    url = mirror://sourceforge/wxwindows/wxWidgets-2.8.11.tar.gz;
    sha256 = "0icxd21g18d42n1ygshkpw0jnflm03iqki6r623pb5hhd7fm2ksj";
  };

  configureFlags = [
    (if compat24 then "--enable-compat24" else "--disable-compat24")
    (if compat26 then "--enable-compat26" else "--disable-compat26")
    "--disable-precomp-headers"
    (if unicode then "--enable-unicode" else "")
    "--with-opengl"
  ];

  preConfigure = "
    substituteInPlace configure --replace /usr /no-such-path
  ";

  postBuild = "(cd contrib/src && make)";

  postInstall = "
    (cd contrib/src && make install)
    (cd $out/include && ln -s wx-*/* .)
  ";

  passthru = {inherit compat24 compat26 unicode;};
}


{ stdenv, fetchurl, bison, pkgconfig }:

stdenv.mkDerivation rec {
  name = "sphinxbase-0.7";

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

  buildInputs = [ pkgconfig bison ];

  meta = {
    description = "Support Library for Pocketsphinx";
    homepage = http://cmusphinx.sourceforge.net;
    license = "free-non-copyleft";
    maintainers = [ stdenv.lib.maintainers.shlevy ];
  };
}

Add flag to play with multiple outputs

{ stdenv
, fetchurl
, bison
, pkgconfig
, multipleOutputs ? false #Uses incomplete features of nix!
}:

stdenv.mkDerivation (rec {
  name = "sphinxbase-0.7";

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

  buildInputs = [ pkgconfig bison ];

  meta = {
    description = "Support Library for Pocketsphinx";
    homepage = http://cmusphinx.sourceforge.net;
    license = "free-non-copyleft";
    maintainers = [ stdenv.lib.maintainers.shlevy ];
  };
} // (stdenv.lib.optionalAttrs multipleOutputs {
  outputs = [ "out" "lib" "headers" ];

  postInstall = ''
    ensureDir $lib
    cp -av $out/lib* $lib

    ensureDir $headers
    cp -av $out/include $headers
  '';
}))


perl:

{ buildInputs ? [], ... } @ attrs:

perl.stdenv.mkDerivation (
  {
    doCheck = true;

    checkTarget = "test";

    # Prevent CPAN downloads.
    PERL_AUTOINSTALL = "--skipdeps";

    # Avoid creating perllocal.pod, which contains a timestamp
    installTargets = "pure_install";

    # From http://wiki.cpantesters.org/wiki/CPANAuthorNotes: "allows
    # authors to skip certain tests (or include certain tests) when
    # the results are not being monitored by a human being."
    AUTOMATED_TESTING = true;
  }
  //
  attrs
  //
  {
    name = "perl-" + attrs.name;
    builder = ./builder.sh;
    buildInputs = buildInputs ++ [ perl ];
  }
)

Make perl modules easier to call

{ perl }:

{ buildInputs ? [], ... } @ attrs:

perl.stdenv.mkDerivation (
  {
    doCheck = true;

    checkTarget = "test";

    # Prevent CPAN downloads.
    PERL_AUTOINSTALL = "--skipdeps";

    # Avoid creating perllocal.pod, which contains a timestamp
    installTargets = "pure_install";

    # From http://wiki.cpantesters.org/wiki/CPANAuthorNotes: "allows
    # authors to skip certain tests (or include certain tests) when
    # the results are not being monitored by a human being."
    AUTOMATED_TESTING = true;
  }
  //
  attrs
  //
  {
    name = "perl-" + attrs.name;
    builder = ./builder.sh;
    buildInputs = buildInputs ++ [ perl ];
  }
)


{ buildToolbox
, postgrest
, dockerTools
, checkedShellScript
}:
let
  image =
    dockerTools.buildImage {
      name = "postgrest";
      tag = "latest";
      contents = postgrest;

      # Set the current time as the image creation date. This makes the build
      # non-reproducible, but that should not be an issue for us.
      created = "now";

      extraCommands =
        ''
          rmdir share
        '';

      config = {
        Cmd = [ "/bin/postgrest" ];
        User = "1000";
        ExposedPorts = {
          "3000/tcp" = { };
        };
      };
    };

  load =
    checkedShellScript
      {
        name = "postgrest-docker-load";
        docs = "Load the PostgREST image into Docker.";
      }
      ''
        docker load -i ${image}
      '';

in
buildToolbox
{
  name = "postgrest-docker";
  tools = [ load ];
  extra = {
    inherit image;
  };
}

Remove deprecation warning for dockerTools.buildImage { contents }

{ buildToolbox
, postgrest
, dockerTools
, checkedShellScript
}:
let
  image =
    dockerTools.buildImage {
      name = "postgrest";
      tag = "latest";
      copyToRoot = postgrest;

      # Set the current time as the image creation date. This makes the build
      # non-reproducible, but that should not be an issue for us.
      created = "now";

      extraCommands =
        ''
          rmdir share
        '';

      config = {
        Cmd = [ "/bin/postgrest" ];
        User = "1000";
        ExposedPorts = {
          "3000/tcp" = { };
        };
      };
    };

  load =
    checkedShellScript
      {
        name = "postgrest-docker-load";
        docs = "Load the PostgREST image into Docker.";
      }
      ''
        docker load -i ${image}
      '';

in
buildToolbox
{
  name = "postgrest-docker";
  tools = [ load ];
  extra = {
    inherit image;
  };
}


{ stdenv, fetchurl, cmake, libpng, libtiff, lcms2 }:

stdenv.mkDerivation rec {
  name = "openjpeg-2.0.0";

  src = fetchurl {
    url = "http://openjpeg.googlecode.com/files/${name}.tar.gz";
    sha256 = "1n05yrmscpgksrh2kfh12h18l0lw9j03mgmvwcg3hm8m0lwgak9k";
  };

  configurePhase = "cmake";

  buildInputs = [ cmake libpng libtiff lcms2 ];

  meta = {
    homepage = http://www.openjpeg.org/;
    description = "Open-source JPEG 2000 codec written in C language";
    license = "BSD";
    platforms = stdenv.lib.platforms.all;
  };
}

Revert "openjpeg: major update": not good yet (mupdf)

{ stdenv, fetchurl }:

stdenv.mkDerivation rec {
  name = "openjpeg-1.5.1";

  src = fetchurl {
    url = "http://openjpeg.googlecode.com/files/${name}.tar.gz";
    sha256 = "13dbyf3jwr4h2dn1k11zph3jgx17z7d66xmi640mbsf8l6bk1yvc";
  };

  meta = {
    homepage = http://www.openjpeg.org/;
    description = "Open-source JPEG 2000 codec written in C language";
    license = "BSD";
    platforms = stdenv.lib.platforms.all;
  };
}


{ fetchurl, stdenv, gmp, mpfr }:
let
  version = "1.0.3";
in
stdenv.mkDerivation rec {
  name = "libmpc-${version}"; # to avoid clash with the MPD client

  src = fetchurl {
    url = "http://www.multiprecision.org/mpc/download/mpc-${version}.tar.gz";
    sha256 = "1hzci2zrrd7v3g1jk35qindq05hbl0bhjcyyisq9z209xb3fqzb1";
  };

  buildInputs = [ gmp mpfr ];

  CFLAGS = "-I${gmp.dev}/include";

  doCheck = true;

  # FIXME needs gcc 4.9 in bootstrap tools
  hardeningDisable = [ "stackprotector" ];

  meta = {
    description = "Library for multiprecision complex arithmetic with exact rounding";

    longDescription =
      '' GNU MPC is a C library for the arithmetic of complex numbers with
         arbitrarily high precision and correct rounding of the result.  It is
         built upon and follows the same principles as GNU MPFR.
      '';

    homepage = http://mpc.multiprecision.org/;
    license = stdenv.lib.licenses.lgpl2Plus;

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

Fix for cross by disabling check

{ stdenv, fetchurl
, gmp, mpfr
, buildPlatform, hostPlatform
}:

let
  version = "1.0.3";
in
stdenv.mkDerivation rec {
  name = "libmpc-${version}"; # to avoid clash with the MPD client

  src = fetchurl {
    url = "http://www.multiprecision.org/mpc/download/mpc-${version}.tar.gz";
    sha256 = "1hzci2zrrd7v3g1jk35qindq05hbl0bhjcyyisq9z209xb3fqzb1";
  };

  buildInputs = [ gmp mpfr ];

  CFLAGS = "-I${gmp.dev}/include";

  doCheck = hostPlatform == buildPlatform;

  # FIXME needs gcc 4.9 in bootstrap tools
  hardeningDisable = [ "stackprotector" ];

  meta = {
    description = "Library for multiprecision complex arithmetic with exact rounding";

    longDescription =
      '' GNU MPC is a C library for the arithmetic of complex numbers with
         arbitrarily high precision and correct rounding of the result.  It is
         built upon and follows the same principles as GNU MPFR.
      '';

    homepage = http://mpc.multiprecision.org/;
    license = stdenv.lib.licenses.lgpl2Plus;

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


{ lib, fetchFromGitHub, python3Packages, httpie }:

python3Packages.buildPythonApplication rec {
  pname = "http-prompt";
  version = "1.0.0";

  src = fetchFromGitHub {
    rev = "v${version}";
    repo = "http-prompt";
    owner = "eliangcs";
    sha256 = "0kngz2izcqjphbrdkg489p0xmf65xjc8ki1a2szcc8sgwc7z74xy";
  };

  propagatedBuildInputs = with python3Packages; [
    click
    httpie
    parsimonious
    (python.pkgs.callPackage ../../../development/python-modules/prompt-toolkit/1.nix {})
    pygments
    six
  ];

  checkPhase = ''
    $out/bin/${pname} --version | grep -q "${version}"
  '';

  meta = with lib; {
    description = "An interactive command-line HTTP client featuring autocomplete and syntax highlighting";
    homepage = "https://github.com/eliangcs/http-prompt";
    license = licenses.mit;
    maintainers = with maintainers; [ matthiasbeyer ];
    platforms = platforms.linux ++ platforms.darwin;
  };
}

Fix owner, repo was moved

{ lib, fetchFromGitHub, python3Packages, httpie }:

python3Packages.buildPythonApplication rec {
  pname = "http-prompt";
  version = "1.0.0";

  src = fetchFromGitHub {
    rev = "v${version}";
    repo = "http-prompt";
    owner = "httpie";
    sha256 = "0kngz2izcqjphbrdkg489p0xmf65xjc8ki1a2szcc8sgwc7z74xy";
  };

  propagatedBuildInputs = with python3Packages; [
    click
    httpie
    parsimonious
    (python.pkgs.callPackage ../../../development/python-modules/prompt-toolkit/1.nix {})
    pygments
    six
  ];

  checkPhase = ''
    $out/bin/${pname} --version | grep -q "${version}"
  '';

  meta = with lib; {
    description = "An interactive command-line HTTP client featuring autocomplete and syntax highlighting";
    homepage = "https://github.com/eliangcs/http-prompt";
    license = licenses.mit;
    maintainers = with maintainers; [ matthiasbeyer ];
    platforms = platforms.linux ++ platforms.darwin;
  };
}


{ stdenv, fetchsvn, xlibsWrapper, libXmu, autoreconfHook }:

stdenv.mkDerivation rec {
  # The last release from 2012, 0.12, lacks '-targets'
  name = "xclip-0.12-svn-20140209";

  src = fetchsvn {
    url = "svn://svn.code.sf.net/p/xclip/code/trunk";
    sha256 = "0d6r38xas5l79l700sdm14l41vvjqhah613367ha8kcvx54zkddz";
  };

  buildInputs = [ xlibsWrapper libXmu autoreconfHook ];

  meta = {
    description = "Tool to access the X clipboard from a console application";
    homepage = http://sourceforge.net/projects/xclip/;
    license = stdenv.lib.licenses.gpl2;
    platforms = stdenv.lib.platforms.all;
  };
}

Fix xclip hash, make revision explicit, in stead of depending on HEAD.

{ stdenv, fetchsvn, xlibsWrapper, libXmu, autoreconfHook }:

stdenv.mkDerivation rec {
  # The last release from 2012, 0.12, lacks '-targets'
  name = "xclip-0.12-svn-20140209";

  src = fetchsvn {
    url = "svn://svn.code.sf.net/p/xclip/code/trunk";
    rev = "87";
    sha256 = "1rbcdgr73916wvzfgqjs1jhgzk8qs1yw2iiqy7ifrkjafhi37w6b";
  };

  buildInputs = [ xlibsWrapper libXmu autoreconfHook ];

  meta = {
    description = "Tool to access the X clipboard from a console application";
    homepage = http://sourceforge.net/projects/xclip/;
    license = stdenv.lib.licenses.gpl2;
    platforms = stdenv.lib.platforms.all;
  };
}


with import ./config.nix;

{ seed ? 0 }:
# A simple content-addressed derivation.
# The derivation can be arbitrarily modified by passing a different `seed`,
# but the output will always be the same
rec {
  rootLegacy = mkDerivation {
    name = "simple-content-addressed";
    buildCommand = ''
      set -x
      echo "Building a legacy derivation"
      mkdir -p $out
      echo "Hello World" > $out/hello
    '';
    __contentAddressed = true;
    outputHashMode = "recursive";
    outputHashAlgo = "sha256";
  };
  rootCA = mkDerivation {
    name = "dependent";
    buildCommand = ''
      echo "building a CA derivation"
      echo "The seed is ${toString seed}"
      mkdir -p $out
      echo ${rootLegacy}/hello > $out/dep
    '';
    __contentAddressed = true;
    outputHashMode = "recursive";
    outputHashAlgo = "sha256";
  };
}

Rename derivation in floating CA test

with import ./config.nix;

{ seed ? 0 }:
# A simple content-addressed derivation.
# The derivation can be arbitrarily modified by passing a different `seed`,
# but the output will always be the same
rec {
  rootLegacy = mkDerivation {
    name = "simple-input-addressed";
    buildCommand = ''
      set -x
      echo "Building a legacy derivation"
      mkdir -p $out
      echo "Hello World" > $out/hello
    '';
    __contentAddressed = true;
    outputHashMode = "recursive";
    outputHashAlgo = "sha256";
  };
  rootCA = mkDerivation {
    name = "dependent";
    buildCommand = ''
      echo "building a CA derivation"
      echo "The seed is ${toString seed}"
      mkdir -p $out
      echo ${rootLegacy}/hello > $out/dep
    '';
    __contentAddressed = true;
    outputHashMode = "recursive";
    outputHashAlgo = "sha256";
  };
}


# This file was auto-generated by cabal2nix. Please do NOT edit manually!

{ cabal, filepath, hspec, HUnit, parsec, split, template
, temporaryRc, text, time
}:

cabal.mkDerivation (self: {
  pname = "hi";
  version = "0.0.8.1";
  sha256 = "14g1yfc6cv89whx6w0di5nayifc0xfvll9h07kkqxaajyfw6s32y";
  isLibrary = true;
  isExecutable = true;
  buildDepends = [
    filepath parsec split template temporaryRc text time
  ];
  testDepends = [
    filepath hspec HUnit parsec split template temporaryRc text time
  ];
  meta = {
    homepage = "https://github.com/fujimura/hi";
    description = "Generate scaffold for cabal project";
    license = self.stdenv.lib.licenses.bsd3;
    platforms = self.ghc.meta.platforms;
  };
})

Update hi to 0.8.2, doCheck set to false

# This file was auto-generated by cabal2nix. Please do NOT edit manually!

{ cabal, doctest, filepath, hspec, HUnit, parsec, split, template
, temporaryRc, text, time
}:

cabal.mkDerivation (self: {
  pname = "hi";
  version = "0.0.8.2";
  sha256 = "0h94wjxdr6g6n3rvkn1xsjqr49p9fgidmraifvz5mzryn6rmd18r";
  isLibrary = true;
  isExecutable = true;
  doCheck = false;
  buildDepends = [
    filepath parsec split template temporaryRc text time
  ];
  testDepends = [
    doctest filepath hspec HUnit parsec split template temporaryRc text
    time
  ];
  meta = {
    homepage = "https://github.com/fujimura/hi";
    description = "Generate scaffold for cabal project";
    license = self.stdenv.lib.licenses.bsd3;
    platforms = self.ghc.meta.platforms;
  };
})


{stdenv, fetchurl, ocaml, findlib}:

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

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

  src = fetchurl {
    url = "http://www.xs4all.nl/~mmzeeman/ocaml/ounit-${version}.tar.gz";
    sha256 = "1n7ylrbi2m00gn0kjg5zxnyzxki8v1dy31fcz3vh1xnwcx6hii97";
  };

  buildInputs = [ocaml findlib];

  configurePhase = "true";  	# Skip configure

  buildFlags = "all allopt";

  doCheck = true;

  checkTarget = "test";

  createFindlibDestdir = true;

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

Update OUnit to version 1.1.0

{stdenv, fetchurl, ocaml, findlib}:

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

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

  src = fetchurl {
    url = http://forge.ocamlcore.org/frs/download.php/495/ounit-1.1.0.tar.gz;
    sha256 = "12vybg9xlw5c8ip23p8cljfzhkdsm25482sf1yh46fcqq8p2jmqx";
  };

  buildInputs = [ocaml findlib];

  dontAddPrefix = true;

  doCheck = true;

  checkTarget = "test";

  createFindlibDestdir = true;

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


{ stdenv, fetchurl, cmake, pkgconfig }:

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

  src = fetchurl {
    url = "mirror://samba/cwrap/${name}.tar.gz";
    sha256 = "0bysdijvi9n0jk74iklbfhbp0kvv81a727lcfd5q03q2hkzjfm18";
  };

  buildInputs = [ cmake pkgconfig (stdenv.cc.libc.out or null) ];
  # outputs TODO: missing glibc.out might become a general problem

  meta = with stdenv.lib; {
    description = "A wrapper for the user, group and hosts NSS API";
    homepage = "https://git.samba.org/?p=nss_wrapper.git;a=summary";
    license = licenses.bsd3;
    maintainers = with maintainers; [ wkennington ];
    platforms = platforms.all;
  };
}

Remove glibc from build inputs hack

{ stdenv, fetchurl, cmake, pkgconfig }:

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

  src = fetchurl {
    url = "mirror://samba/cwrap/${name}.tar.gz";
    sha256 = "0bysdijvi9n0jk74iklbfhbp0kvv81a727lcfd5q03q2hkzjfm18";
  };

  buildInputs = [ cmake pkgconfig ];

  meta = with stdenv.lib; {
    description = "A wrapper for the user, group and hosts NSS API";
    homepage = "https://git.samba.org/?p=nss_wrapper.git;a=summary";
    license = licenses.bsd3;
    maintainers = with maintainers; [ wkennington ];
    platforms = platforms.all;
  };
}


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

with lib;

let

  cfg = config.system;

in

{
  options = {
  };

  config = {

    system.build.applications = pkgs.buildEnv {
      name = "system-applications";
      paths = config.environment.systemPackages;
      pathsToLink = "/Applications";
    };

    system.activationScripts.applications.text = ''
      # Set up applications.
      echo "setting up ~/Applications..." >&2

      if [ ! -e ~/Applications -o -L ~/Applications ]; then
        ln -sfn ${cfg.build.applications}/Applications ~/Applications
      else
        echo "warning: ~/Applications is a directory, skipping..." >&2
      fi
    '';

  };
}

Make symlink within ~/Applications if it exists instead of skipping

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

with lib;

let

  cfg = config.system;

in

{
  options = {
  };

  config = {

    system.build.applications = pkgs.buildEnv {
      name = "system-applications";
      paths = config.environment.systemPackages;
      pathsToLink = "/Applications";
    };

    system.activationScripts.applications.text = ''
      # Set up applications.
      echo "setting up ~/Applications..." >&2

      if [ ! -e ~/Applications -o -L ~/Applications ]; then
        ln -sfn ${cfg.build.applications}/Applications ~/Applications
      elif [ ! -e ~/Applications/Nix\ Apps -o -L ~/Applications/Nix\ Apps ]; then
        ln -sfn ${cfg.build.applications}/Applications ~/Applications/Nix\ Apps
      else
        echo "warning: ~/Applications and ~/Applications/Nix Apps are directories, skipping App linking..." >&2
      fi
    '';

  };
}


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

{config, pkgs, ...}:

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

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

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

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

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

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

{config, pkgs, ...}:

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

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

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


{ builderDefs, scons, pkgconfig, gtk, bzip2, libglade, openssl, libX11 }:

with builderDefs;
	let localDefs = builderDefs.passthru.function ((rec {
		src = /* put a fetchurl here */
		fetchurl {
			url = http://launchpad.net/linuxdcpp/1.0/1.0.3/+download/linuxdcpp-1.0.3.tar.bz2;
			sha256 = "0w9c8k13cl85y4v4av8ic6w4zkdivcj6p5q86llfh3sz077vckiv";
		};

		buildInputs = [scons pkgconfig gtk bzip2 libglade
			openssl libX11];
		configureFlags = [];
		doScons = fullDepEntry (''
			ensureDir $out
			export NIX_LDFLAGS="$NIX_LDFLAGS -lX11";
			scons PREFIX=$out
			scons PREFIX=$out install
		'') ["minInit" "doUnpack" "addInputs" "defEnsureDir"];
	}));
	in with localDefs;
stdenv.mkDerivation rec {
	name = "ldcpp-1.0.3";
	builder = writeScript (name + "-builder")
		(textClosure localDefs
			[doScons doForceShare doPropagate]);
	meta = {
		description = "Linux DC++ - Direct Connect client";
		inherit src;
	};
}

Update LinuxDC++. Does not eliminate some of the strange segfaults

{ builderDefs, scons, pkgconfig, gtk, bzip2, libglade, openssl, libX11, boost, zlib }:

with builderDefs;
  let localDefs = builderDefs.passthru.function ((rec {
    src = /* put a fetchurl here */
    fetchurl {
      url = http://launchpad.net/linuxdcpp/1.1/1.1.0/+download/linuxdcpp-1.1.0.tar.bz2;
      sha256 = "66012740e9347a2e994c8af5609c40ebf3f86f767258e071a03ef39a2314298a";
    };

    buildInputs = [scons pkgconfig gtk bzip2 libglade
      openssl libX11 boost];
    configureFlags = [];
    doScons = fullDepEntry (''
      ensureDir $out
      export NIX_LDFLAGS="$NIX_LDFLAGS -lX11";

      for i in gettext xgettext msgfmt msgcat; do
        echo > $i
	chmod a+x $i
      done
      export PATH=$PATH:$PWD

      scons PREFIX=$out
      scons PREFIX=$out install
    '') ["minInit" "doUnpack" "addInputs" "defEnsureDir"];
  }));
  in with localDefs;
stdenv.mkDerivation rec {
  name = "ldcpp-1.1.0";
  builder = writeScript (name + "-builder")
    (textClosure localDefs
      [doScons doForceShare doPropagate]);
  meta = {
    description = "Linux DC++ - Direct Connect client";
    inherit src;
  };
}


{ stdenv, fetchurl, pkgconfig, xorg }:

stdenv.mkDerivation rec {
  name = "libvdpau-1.1";

  src = fetchurl {
    url = "http://people.freedesktop.org/~aplattner/vdpau/${name}.tar.gz";
    sha256 = "069r4qc934xw3z20hpmg0gx0al7fl1kdik1r46x2dgr0ya1yg95f";
  };

  buildInputs = with xorg; [ pkgconfig dri2proto libXext ];

  propagatedBuildInputs = [ xorg.libX11 ];

  configureFlags = stdenv.lib.optional stdenv.isDarwin "--build=x86_64";

  meta = with stdenv.lib; {
    homepage = http://people.freedesktop.org/~aplattner/vdpau/;
    description = "Library to use the Video Decode and Presentation API for Unix (VDPAU)";
    license = licenses.mit; # expat version
    platforms = platforms.unix;
    maintainers = [ maintainers.vcunat ];
  };
}

Build shared libraries on Darwin

{ stdenv, fetchurl, pkgconfig, xorg }:

stdenv.mkDerivation rec {
  name = "libvdpau-1.1";

  src = fetchurl {
    url = "http://people.freedesktop.org/~aplattner/vdpau/${name}.tar.gz";
    sha256 = "069r4qc934xw3z20hpmg0gx0al7fl1kdik1r46x2dgr0ya1yg95f";
  };

  buildInputs = with xorg; [ pkgconfig dri2proto libXext ];

  propagatedBuildInputs = [ xorg.libX11 ];

  meta = with stdenv.lib; {
    homepage = http://people.freedesktop.org/~aplattner/vdpau/;
    description = "Library to use the Video Decode and Presentation API for Unix (VDPAU)";
    license = licenses.mit; # expat version
    platforms = platforms.unix;
    maintainers = [ maintainers.vcunat ];
  };
}