{ lib
, buildPythonPackage
, fetchPypi
, pytestCheckHook
, case
, psutil
, pythonOlder
}:

buildPythonPackage rec {
  pname = "billiard";
  version = "4.0.2";
  format = "setuptools";

  disabled = pythonOlder "3.7";

  src = fetchPypi {
    inherit pname version;
    sha256 = "sha256-jUFd+FrDG5dXlxJaxIZJL+TF5OJx07DfdWHrI0YsmwM=";
  };

  checkInputs = [
    case
    psutil
    pytestCheckHook
  ];

  disabledTests = [
    # psutil.NoSuchProcess: process no longer exists (pid=168)
    "test_set_pdeathsig"
  ];

  pythonImportsCheck = [
    "billiard"
  ];

  meta = with lib; {
    description = "Python multiprocessing fork with improvements and bugfixes";
    homepage = "https://github.com/celery/billiard";
    license = licenses.bsd3;
    maintainers = with maintainers; [ ];
  };
}

Revert "python3Packages.billiard: 4.0.0 -> 4.0.2"

{ lib
, buildPythonPackage
, fetchPypi
, pytestCheckHook
, case
, psutil
, pythonOlder
}:

buildPythonPackage rec {
  pname = "billiard";
  version = "4.0.0";
  format = "setuptools";

  disabled = pythonOlder "3.7";

  src = fetchPypi {
    inherit pname version;
    sha256 = "sha256-NE2aHX063fFx6yxZbJ6Y0e/4Gw4D8fk5iTmjUYyiY6k=";
  };

  checkInputs = [
    case
    psutil
    pytestCheckHook
  ];

  disabledTests = [
    # psutil.NoSuchProcess: process no longer exists (pid=168)
    "test_set_pdeathsig"
  ];

  pythonImportsCheck = [
    "billiard"
  ];

  meta = with lib; {
    description = "Python multiprocessing fork with improvements and bugfixes";
    homepage = "https://github.com/celery/billiard";
    license = licenses.bsd3;
    maintainers = with maintainers; [ ];
  };
}


{ stdenv, fetchurl, pkgconfig, writeText, libX11, ncurses
, libXft, conf ? null, patches ? [], extraLibs ? []}:

with stdenv.lib;

stdenv.mkDerivation rec {
  name = "st-0.8.2";

  src = fetchurl {
    url = "https://dl.suckless.org/st/${name}.tar.gz";
    sha256 = "0ddz2mdp1c7q67rd5vrvws9r0493ln0mlqyc3d73dv8im884xdxf";
  };

  inherit patches;

  prePatch = optionalString (conf != null) ''
    cp ${writeText "config.def.h" conf} config.def.h
  '';

  nativeBuildInputs = [ pkgconfig ncurses ];
  buildInputs = [ libX11 libXft ] ++ extraLibs;

  installPhase = ''
    TERMINFO=$out/share/terminfo make install PREFIX=$out
  '';

  meta = {
    homepage = "https://st.suckless.org/";
    description = "Simple Terminal for X from Suckless.org Community";
    license = licenses.mit;
    maintainers = with maintainers; [andsild];
    platforms = platforms.linux;
  };
}

Revert "st: copy config file in 'prePatch' instead of 'preBuild'"

{ stdenv, fetchurl, pkgconfig, writeText, libX11, ncurses
, libXft, conf ? null, patches ? [], extraLibs ? []}:

with stdenv.lib;

stdenv.mkDerivation rec {
  name = "st-0.8.2";

  src = fetchurl {
    url = "https://dl.suckless.org/st/${name}.tar.gz";
    sha256 = "0ddz2mdp1c7q67rd5vrvws9r0493ln0mlqyc3d73dv8im884xdxf";
  };

  inherit patches;

  configFile = optionalString (conf!=null) (writeText "config.def.h" conf);
  postPatch = optionalString (conf!=null) "cp ${configFile} config.def.h";

  nativeBuildInputs = [ pkgconfig ncurses ];
  buildInputs = [ libX11 libXft ] ++ extraLibs;

  installPhase = ''
    TERMINFO=$out/share/terminfo make install PREFIX=$out
  '';

  meta = {
    homepage = "https://st.suckless.org/";
    description = "Simple Terminal for X from Suckless.org Community";
    license = licenses.mit;
    maintainers = with maintainers; [andsild];
    platforms = platforms.linux;
  };
}


{ aspell, audiofile
, gsmakeDerivation
, cups
, fetchurl
, gmp, gnutls
, libffi
, libjpeg, libtiff, libpng, giflib, libungif
, libxml2, libxslt, libiconv
, libobjc, libgcrypt
, icu
, pkgconfig, portaudio
}:
let
  version = "1.25.1";
in
gsmakeDerivation {
  name = "gnustep-base-${version}";
  src = fetchurl {
    url = "ftp://ftp.gnustep.org/pub/gnustep/core/gnustep-base-${version}.tar.gz";
    sha256 = "17mnilg28by74wc08nkwp6gi06x3j2nrcf05wg64nrw5ljffp2zj";
  };
  nativeBuildInputs = [ pkgconfig ];
  propagatedBuildInputs = [
    aspell audiofile
    cups
    gmp gnutls
    libffi
    libjpeg libtiff libpng giflib libungif
    libxml2 libxslt libiconv
    libobjc libgcrypt
    icu
    portaudio
  ];
  patches = [ ./fixup-paths.patch ];
  meta = {
    description = "An implementation of AppKit and Foundation libraries of OPENSTEP and Cocoa";
  };
}

Add explicit dependency on libbfd

{ aspell, audiofile
, gsmakeDerivation
, cups
, fetchurl
, gmp, gnutls
, libffi, libbfd
, libjpeg, libtiff, libpng, giflib, libungif
, libxml2, libxslt, libiconv
, libobjc, libgcrypt
, icu
, pkgconfig, portaudio
}:
let
  version = "1.25.1";
in
gsmakeDerivation {
  name = "gnustep-base-${version}";
  src = fetchurl {
    url = "ftp://ftp.gnustep.org/pub/gnustep/core/gnustep-base-${version}.tar.gz";
    sha256 = "17mnilg28by74wc08nkwp6gi06x3j2nrcf05wg64nrw5ljffp2zj";
  };
  nativeBuildInputs = [ pkgconfig ];
  propagatedBuildInputs = [
    aspell audiofile
    cups
    gmp gnutls
    libffi libbfd
    libjpeg libtiff libpng giflib libungif
    libxml2 libxslt libiconv
    libobjc libgcrypt
    icu
    portaudio
  ];
  patches = [ ./fixup-paths.patch ];
  meta = {
    description = "An implementation of AppKit and Foundation libraries of OPENSTEP and Cocoa";
  };
}


{ pkgs ? import <nixpkgs> {} }:

let
  myEmacs = pkgs.emacs;
  emacsWithPackages = (pkgs.emacsPackagesNgGen myEmacs).emacsWithPackages;
in
  emacsWithPackages (epkgs: (with epkgs.melpaStablePackages; [
  ]) ++ (with epkgs.melpaPackages; [
    auto-complete
    dockerfile-mode
    flycheck
    haskell-mode
    hl-todo
    indent-guide
    json-mode
    magit
    markdown-mode
    multiple-cursors
    neotree
    nix-mode
    projectile
    scala-mode
    smartparens
    smooth-scrolling
    use-package
    yaml-mode
    zerodark-theme
  ]) ++ (with epkgs.elpaPackages; [
    beacon
  ]))

Switch magit to melpaStable, recent commits is broken

{ pkgs ? import <nixpkgs> {} }:

let
  myEmacs = pkgs.emacs;
  emacsWithPackages = (pkgs.emacsPackagesNgGen myEmacs).emacsWithPackages;
in
  emacsWithPackages (epkgs: (with epkgs.melpaStablePackages; [
    auto-complete
    dockerfile-mode
    flycheck
    haskell-mode
    hl-todo
    indent-guide
    json-mode
    magit
    markdown-mode
    multiple-cursors
    neotree
    nix-mode
    projectile
    scala-mode
    smartparens
    smooth-scrolling
    use-package
    yaml-mode
    zerodark-theme
  ]) ++ (with epkgs.elpaPackages; [
    beacon
  ]))


{ cabal, binary, fastLogger, hspec, liftedBase, monadControl
, monadLogger, pcreLight, text, thyme, transformers, vectorSpace
}:

cabal.mkDerivation (self: {
  pname = "logging";
  version = "1.3.0";
  sha256 = "1d2is6p828xvh59f9b971xf0w2l229652rniccxpm2mcfs893c79";
  buildDepends = [
    binary fastLogger liftedBase monadControl monadLogger pcreLight
    text thyme transformers vectorSpace
  ];
  testDepends = [ hspec monadLogger ];
  meta = {
    description = "Simplified logging in IO for application writers";
    license = self.stdenv.lib.licenses.mit;
    platforms = self.ghc.meta.platforms;
  };
})

Update logging expression to 1.4.0

{ cabal, binary, fastLogger, hspec, liftedBase, monadControl
, monadLogger, pcreLight, text, time, transformers, vectorSpace
}:

cabal.mkDerivation (self: {
  pname = "logging";
  version = "1.4.0";
  sha256 = "0xkk6j9wa5n0qg0wp7a9bwaz328hrjk1fwanpa515hh3gvz62g94";
  buildDepends = [
    binary fastLogger liftedBase monadControl monadLogger pcreLight
    text time transformers vectorSpace
  ];
  testDepends = [ hspec monadLogger ];
  meta = {
    description = "Simplified logging in IO for application writers";
    license = self.stdenv.lib.licenses.mit;
    platforms = self.ghc.meta.platforms;
  };
})


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

stdenv.mkDerivation rec {
  pname = "iasl";
  version = "20191213";

  src = fetchurl {
    url = "https://acpica.org/sites/acpica/files/acpica-unix-${version}.tar.gz";
    sha256 = "1ip684is3dplf7snkn024vv6bg3dv5msx8v7pz6x9lrnk3gk0j9h";
  };

  NIX_CFLAGS_COMPILE = [ "-O3" ];

  buildFlags = [ "iasl" ];

  buildInputs = [ bison flex ];

  installPhase =
    ''
      install -d $out/bin
      install generate/unix/bin*/iasl $out/bin
    '';

  meta = {
    description = "Intel ACPI Compiler";
    homepage = http://www.acpica.org/;
    license = stdenv.lib.licenses.iasl;
    platforms = stdenv.lib.platforms.unix;
  };
}

Revert "iasl: make NIX_CFLAGS_COMPILE a list"

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

stdenv.mkDerivation rec {
  pname = "iasl";
  version = "20191213";

  src = fetchurl {
    url = "https://acpica.org/sites/acpica/files/acpica-unix-${version}.tar.gz";
    sha256 = "1ip684is3dplf7snkn024vv6bg3dv5msx8v7pz6x9lrnk3gk0j9h";
  };

  NIX_CFLAGS_COMPILE = "-O3";

  buildFlags = [ "iasl" ];

  buildInputs = [ bison flex ];

  installPhase =
    ''
      install -d $out/bin
      install generate/unix/bin*/iasl $out/bin
    '';

  meta = {
    description = "Intel ACPI Compiler";
    homepage = http://www.acpica.org/;
    license = stdenv.lib.licenses.iasl;
    platforms = stdenv.lib.platforms.unix;
  };
}


{ stdenv, lib, fetchFromGitHub, cmake, pkgconfig, openblas, libpng, libjpeg
, guiSupport ? false, libX11
}:

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

  src = fetchFromGitHub {
    owner = "davisking";
    repo = "dlib";
    rev ="v${version}";
    sha256 = "0sgxblf4n33b8wgblyblmrkwydvy1yh7fzll1b6c4zgkz675w0m5";
  };

  postPatch = ''
    rm -rf dlib/external
  '';

  enableParallelBuilding = true;
  nativeBuildInputs = [ cmake pkgconfig ];
  buildInputs = [ openblas libpng libjpeg ] ++ lib.optional guiSupport libX11;

  meta = with stdenv.lib; {
    description = "A general purpose cross-platform C++ machine learning library";
    homepage = http://www.dlib.net;
    license = licenses.boost;
    maintainers = with maintainers; [ christopherpoole ];
    platforms = platforms.all;
  };
}

Revert "dlib: 19.9 -> 19.10"

{ stdenv, lib, fetchFromGitHub, cmake, pkgconfig, openblas, libpng, libjpeg
, guiSupport ? false, libX11
}:

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

  src = fetchFromGitHub {
    owner = "davisking";
    repo = "dlib";
    rev ="v${version}";
    sha256 = "0lc54r928j9dg7f2wn25m887z24d31wrc14v2hn6aknp1z084lrc";
  };

  postPatch = ''
    rm -rf dlib/external
  '';

  enableParallelBuilding = true;
  nativeBuildInputs = [ cmake pkgconfig ];
  buildInputs = [ openblas libpng libjpeg ] ++ lib.optional guiSupport libX11;

  meta = with stdenv.lib; {
    description = "A general purpose cross-platform C++ machine learning library";
    homepage = http://www.dlib.net;
    license = licenses.boost;
    maintainers = with maintainers; [ christopherpoole ];
    platforms = platforms.all;
  };
}


{ stdenv, fetchurl, fetchpatch, lvm2, json_c
, openssl, libuuid, pkgconfig, popt
, enablePython ? false, python2 ? null }:

assert enablePython -> python2 != null;

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

  src = fetchurl {
    url = "mirror://kernel/linux/utils/cryptsetup/v2.0/${name}.tar.xz";
    sha256 = "0d2p9g2wqcv6l3671gvw96p16jadbgyh21ddy2bhqgi96dq3qflx";
  };

  NIX_LDFLAGS = "-lgcc_s";

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

  nativeBuildInputs = [ pkgconfig ];
  buildInputs = [ lvm2 json_c openssl libuuid popt ]
    ++ stdenv.lib.optional enablePython python2;

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

Split outputs to out, dev and man

{ stdenv, fetchurl, fetchpatch, lvm2, json_c
, openssl, libuuid, pkgconfig, popt
, enablePython ? false, python2 ? null }:

assert enablePython -> python2 != null;

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

  outputs = [ "out" "dev" "man" ];

  src = fetchurl {
    url = "mirror://kernel/linux/utils/cryptsetup/v2.0/${name}.tar.xz";
    sha256 = "0d2p9g2wqcv6l3671gvw96p16jadbgyh21ddy2bhqgi96dq3qflx";
  };

  NIX_LDFLAGS = "-lgcc_s";

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

  nativeBuildInputs = [ pkgconfig ];
  buildInputs = [ lvm2 json_c openssl libuuid popt ]
    ++ stdenv.lib.optional enablePython python2;

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


{ fetchurl, stdenv }:

stdenv.mkDerivation rec {
  name = "pax-utils-${version}";
  version = "1.0";

  src = fetchurl {
    url = "http://dev.gentoo.org/~vapier/dist/${name}.tar.xz";
    sha256 = "04p356j46symayh2d14i51xv9qic3iz9gnc7fr906skw3hccr7y3";
  };

  makeFlags = [
    "DESTDIR=$(out)"
    "PREFIX=$(out)"
  ];

  meta = with stdenv.lib; {
    description = "A suite of tools for PaX/grsecurity";
    homepage    = "http://dev.gentoo.org/~vapier/dist/";
    license     = licenses.gpl2;
    platforms   = platforms.linux;
    maintainers = with maintainers; [ thoughtpolice wizeman ];
  };
}

Update from 1.0 -> 1.0.1

{ fetchurl, stdenv }:

stdenv.mkDerivation rec {
  name = "pax-utils-${version}";
  version = "1.0.1";

  src = fetchurl {
    url = "http://dev.gentoo.org/~vapier/dist/${name}.tar.xz";
    sha256 = "0v14dvkg19yabh0ijy8fbrvapxvc36dwhvp90py3baq7qb44wrc7";
  };

  makeFlags = [
    "DESTDIR=$(out)"
    "PREFIX=$(out)"
  ];

  meta = with stdenv.lib; {
    description = "A suite of tools for PaX/grsecurity";
    homepage    = "http://dev.gentoo.org/~vapier/dist/";
    license     = licenses.gpl2;
    platforms   = platforms.linux;
    maintainers = with maintainers; [ thoughtpolice wizeman ];
  };
}


{network, testScript, manifestFile, disnix, socat, concatMapStrings, dysnomiaStateDir ? "/tmp/shared/dysnomia"}:

''
  startAll;
  my $pid;

  ${concatMapStrings (targetName:
    ''
      ${"\$"}${targetName}->waitForJob("network.target");
      ${"\$"}${targetName}->waitForJob("disnix.service");
      ${"\$"}${targetName}->mustSucceed("iptables -I INPUT -p tcp --dport 512 -j ACCEPT || true");
      $pid = ${"\$"}${targetName}->mustSucceed("${socat}/bin/socat tcp-listen:512,fork exec:/bin/sh & echo -n \$!");
      ${"\$"}${targetName}->mustSucceed("while [ \"\$(ps -p $pid | grep socat)\" = \"\" ]; do sleep 0.5; done");
    '') (builtins.attrNames network)}

    ${"\$"}${builtins.head (builtins.attrNames network)}->mustSucceed("${disnix}/bin/disnix-activate --no-upgrade ${manifestFile}");
    ${"\$"}${builtins.head (builtins.attrNames network)}->mustSucceed("DYSNOMIA_STATEDIR=${dysnomiaStateDir} ${disnix}/bin/disnix-restore --no-upgrade ${manifestFile}");

    ${testScript}
''

Fix addressing the snapshot store

{network, testScript, manifestFile, disnix, socat, concatMapStrings, dysnomiaStateDir ? "/tmp/shared/dysnomia"}:

''
  startAll;
  my $pid;

  ${concatMapStrings (targetName:
    ''
      ${"\$"}${targetName}->waitForJob("network.target");
      ${"\$"}${targetName}->waitForJob("disnix.service");
      ${"\$"}${targetName}->mustSucceed("iptables -I INPUT -p tcp --dport 512 -j ACCEPT || true");
      $pid = ${"\$"}${targetName}->mustSucceed("${socat}/bin/socat tcp-listen:512,fork exec:/bin/sh & echo -n \$!");
      ${"\$"}${targetName}->mustSucceed("while [ \"\$(ps -p $pid | grep socat)\" = \"\" ]; do sleep 0.5; done");
      ${"\$"}${targetName}->mustSucceed("mkdir -p /var/state");
      ${"\$"}${targetName}->mustSucceed("ln -s ${dysnomiaStateDir} /var/state/dysnomia");
    '') (builtins.attrNames network)}

    ${"\$"}${builtins.head (builtins.attrNames network)}->mustSucceed("${disnix}/bin/disnix-activate --no-upgrade ${manifestFile}");
    ${"\$"}${builtins.head (builtins.attrNames network)}->mustSucceed("${disnix}/bin/disnix-restore --no-upgrade ${manifestFile}");

    ${testScript}
''


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

{
  imports = [
    ../home/shell.nix
    ./web.nix
  ];

  environment.systemPackages = with pkgs; [
    wget git curl nodejs htop neovim nodejs thelounge
  ];

  programs.tmux = {
    enable = true;
    extraTmuxConf = ''
      set -s escape-time 0
      # remap prefix to Control + a
      set -g prefix C-a
      # bind 'C-a C-a' to type 'C-a'
      bind C-a send-prefix
      unbind C-b
    '';
  };
}

Remove thelounge from system packages

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

{
  imports = [
    ../home/shell.nix
    ./web.nix
  ];

  environment.systemPackages = with pkgs; [
    wget git curl nodejs htop neovim nodejs
  ];

  programs.tmux = {
    enable = true;
    extraTmuxConf = ''
      set -s escape-time 0
      # remap prefix to Control + a
      set -g prefix C-a
      # bind 'C-a C-a' to type 'C-a'
      bind C-a send-prefix
      unbind C-b
    '';
  };
}


{ lib, stdenv, fetchurl, pidgin, intltool, libxml2, gmime, nss }:

stdenv.mkDerivation rec {
  pname = "pidgin-sipe";
  version = "1.25.0";

  src = fetchurl {
    url = "mirror://sourceforge/sipe/${pname}-${version}.tar.gz";
    sha256 = "0262sz00iqxylx0xfyr48xikhiqzr8pg7b4b7vwj5iv4qxpxv939";
  };

  nativeBuildInputs = [ intltool ];
  buildInputs = [ pidgin gmime libxml2 nss ];
  enableParallelBuilding = true;

  postInstall = "ln -s \$out/lib/purple-2 \$out/share/pidgin-sipe";

  meta = with lib; {
    description = "SIPE plugin for Pidgin IM";
    homepage = "http://sipe.sourceforge.net/";
    license = licenses.gpl2;
    platforms = platforms.linux;
  };
}

Fix build with latest GLib

{ lib, stdenv, fetchurl, fetchpatch, pidgin, intltool, libxml2, gmime, nss }:

stdenv.mkDerivation rec {
  pname = "pidgin-sipe";
  version = "1.25.0";

  src = fetchurl {
    url = "mirror://sourceforge/sipe/${pname}-${version}.tar.gz";
    sha256 = "0262sz00iqxylx0xfyr48xikhiqzr8pg7b4b7vwj5iv4qxpxv939";
  };

  patches = [
    # add sipe_utils_memdup() function
    (fetchpatch {
      url = "https://repo.or.cz/siplcs.git/patch/567d0ddc0692adfef5f15d0d383825a9b2ea4b49";
      sha256 = "24L8ZfoOGc3JoTCGxuTNjuHzt5QgFDu1+vSoJpGvde4=";
    })
    # replace g_memdup() with sipe_utils_memdup()
    # g_memdup is deprecatein newer Glib
    (fetchpatch {
      url = "https://repo.or.cz/siplcs.git/patch/583a734e63833f03d11798b7b0d59a17d08ae60f";
      sha256 = "Ai6Czpy/FYvBi4GZR7yzch6OcouJgfreI9HcojhGVV4=";
    })
  ];

  nativeBuildInputs = [ intltool ];
  buildInputs = [ pidgin gmime libxml2 nss ];
  enableParallelBuilding = true;

  postInstall = "ln -s \$out/lib/purple-2 \$out/share/pidgin-sipe";

  meta = with lib; {
    description = "SIPE plugin for Pidgin IM";
    homepage = "http://sipe.sourceforge.net/";
    license = licenses.gpl2;
    platforms = platforms.linux;
  };
}


{ stdenv, lib, fetchFromGitHub, rustPlatform, pkg-config, openssl, Security }:

rustPlatform.buildRustPackage rec {
  version = "0.2.15";
  pname = "sccache";

  src = fetchFromGitHub {
    owner = "mozilla";
    repo = "sccache";
    rev = "v${version}";
    sha256 = "1kygk7ilv7la36kv4jdn1ird7f3896wgr88kyqf0iagfqkzb2vsb";
  };

  cargoSha256 = "1f42cqaqnjwi9k4ihqil6z2dqh5dnf76x54gk7mndzkrfg3rl573";

  nativeBuildInputs = [ pkg-config ];
  buildInputs = [ openssl ] ++ lib.optional stdenv.isDarwin Security;

  buildFeatures = lib.optionals (!stdenv.isDarwin) [ "dist-client" "dist-server" ];

  # Tests fail because of client server setup which is not possible inside the pure environment,
  # see https://github.com/mozilla/sccache/issues/460
  doCheck = false;

  meta = with lib; {
    description = "Ccache with Cloud Storage";
    homepage = "https://github.com/mozilla/sccache";
    maintainers = with maintainers; [ doronbehar ];
    license = licenses.asl20;
  };
}

Fix sccache compilation on aarch64-linux platform

{ stdenv, lib, fetchFromGitHub, rustPlatform, pkg-config, openssl, Security }:

rustPlatform.buildRustPackage rec {
  version = "0.2.15";
  pname = "sccache";

  src = fetchFromGitHub {
    owner = "mozilla";
    repo = "sccache";
    rev = "v${version}";
    sha256 = "1kygk7ilv7la36kv4jdn1ird7f3896wgr88kyqf0iagfqkzb2vsb";
  };

  cargoSha256 = "1f42cqaqnjwi9k4ihqil6z2dqh5dnf76x54gk7mndzkrfg3rl573";

  nativeBuildInputs = [ pkg-config ];
  buildInputs = [ openssl ] ++ lib.optional stdenv.isDarwin Security;

  # sccache-dist is only supported on x86_64 Linux machines.
  buildFeatures = lib.optionals (stdenv.system == "x86_64-linux") [ "dist-client" "dist-server" ];

  # Tests fail because of client server setup which is not possible inside the pure environment,
  # see https://github.com/mozilla/sccache/issues/460
  doCheck = false;

  meta = with lib; {
    description = "Ccache with Cloud Storage";
    homepage = "https://github.com/mozilla/sccache";
    maintainers = with maintainers; [ doronbehar ];
    license = licenses.asl20;
  };
}


{ stdenv, fetchurl, pythonPackages, python }:

pythonPackages.buildPythonPackage rec {
  version = "1.6.10";
  name = "ansible-${version}";
  namePrefix = "";

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

  prePatch = ''
    sed -i "s,\/usr\/share\/ansible\/,$out/share/ansible," lib/ansible/constants.py
  '';

  doCheck = false;
  dontStrip = true;
  dontPatchELF = true;
  dontPatchShebangs = true;

  propagatedBuildInputs = with pythonPackages; [
    paramiko jinja2 pyyaml httplib2 boto
  ];

  postFixup = ''
      wrapPythonProgramsIn $out/bin "$out $pythonPath"
  '';

  meta = with stdenv.lib; {
    homepage = "http://www.ansible.com";
    description = "A simple automation tool";
    license = licenses.gpl3;
    maintainers = [ maintainers.joamaki ];
    platforms = platforms.linux; # Only tested on Linux
  };
}

Allow ansible to install on darwin platforms

{ stdenv, fetchurl, pythonPackages, python }:

pythonPackages.buildPythonPackage rec {
  version = "1.6.10";
  name = "ansible-${version}";
  namePrefix = "";

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

  prePatch = ''
    sed -i "s,\/usr\/share\/ansible\/,$out/share/ansible," lib/ansible/constants.py
  '';

  doCheck = false;
  dontStrip = true;
  dontPatchELF = true;
  dontPatchShebangs = true;

  propagatedBuildInputs = with pythonPackages; [
    paramiko jinja2 pyyaml httplib2 boto
  ];

  postFixup = ''
      wrapPythonProgramsIn $out/bin "$out $pythonPath"
  '';

  meta = with stdenv.lib; {
    homepage = "http://www.ansible.com";
    description = "A simple automation tool";
    license = licenses.gpl3;
    maintainers = [ maintainers.joamaki ];
    platforms = platforms.linux ++ [ "x86_64-darwin" ];
  };
}


{ lib
, stdenv
, buildPythonPackage
, fetchPypi
, click
, mock
, pytestCheckHook
, google-auth
, requests_oauthlib
}:

buildPythonPackage rec {
  pname = "google-auth-oauthlib";
  version = "0.5.1";

  src = fetchPypi {
    inherit pname version;
    sha256 = "sha256-MFlrgk/GgI/ayi8EjkmYzED7SzWZ6upm0o3HCFs2xbg=";
  };

  propagatedBuildInputs = [
    google-auth
    requests_oauthlib
  ];

  checkInputs = [
    click
    mock
    pytestCheckHook
  ];

  disabledTests = lib.optionals stdenv.isDarwin [ "test_run_local_server" ];

  meta = with lib; {
    description = "Google Authentication Library: oauthlib integration";
    homepage = "https://github.com/GoogleCloudPlatform/google-auth-library-python-oauthlib";
    license = licenses.asl20;
    maintainers = with maintainers; [ SuperSandro2000 terlar ];
  };
}

Revert "python39Packages.google-auth-oauthlib: 0.4.6 -> 0.5.1"

{ lib
, stdenv
, buildPythonPackage
, fetchPypi
, click
, mock
, pytestCheckHook
, google-auth
, requests_oauthlib
}:

buildPythonPackage rec {
  pname = "google-auth-oauthlib";
  version = "0.4.6";

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

  propagatedBuildInputs = [
    google-auth
    requests_oauthlib
  ];

  checkInputs = [
    click
    mock
    pytestCheckHook
  ];

  disabledTests = lib.optionals stdenv.isDarwin [ "test_run_local_server" ];

  meta = with lib; {
    description = "Google Authentication Library: oauthlib integration";
    homepage = "https://github.com/GoogleCloudPlatform/google-auth-library-python-oauthlib";
    license = licenses.asl20;
    maintainers = with maintainers; [ SuperSandro2000 terlar ];
  };
}


{stdenv, fetchurl, qt4, qmake4Hook, exiv2, openexr, fftwSinglePrec, libtiff, ilmbase }:

stdenv.mkDerivation rec {
  name = "qtpfsgui-1.9.3";

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

  buildInputs = [ qt4 exiv2 openexr fftwSinglePrec libtiff ];
  nativeBuildInputs = [ qmake4Hook ];

  preConfigure = ''
    export CPATH="${ilmbase}/include/OpenEXR:$CPATH"
  '';

  qmakeFlags = [
    "EXIV2PATH=${exiv2}/include/exiv2"
    "OPENEXRDIR=${openexr}/include/OpenEXR"
    "FFTW3DIR=${fftwSinglePrec.dev}/include"
    "LIBTIFFDIR=${libtiff.dev}/include"
  ];

  meta = {
    homepage = http://qtpfsgui.sourceforge.net/;
    description = "Qtpfsqui, a graphical application for high dynamic range (HDR) imaging";

    longDescription =
      '' Qtpfsgui is an open source graphical user interface application that
         aims to provide a workflow for high dynamic range (HDR) imaging.
      '';

    license = stdenv.lib.licenses.gpl2Plus;

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

Make explicit that 'dev' output of exiv2 is used

{stdenv, fetchurl, qt4, qmake4Hook, exiv2, openexr, fftwSinglePrec, libtiff, ilmbase }:

stdenv.mkDerivation rec {
  name = "qtpfsgui-1.9.3";

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

  buildInputs = [ qt4 exiv2 openexr fftwSinglePrec libtiff ];
  nativeBuildInputs = [ qmake4Hook ];

  preConfigure = ''
    export CPATH="${ilmbase}/include/OpenEXR:$CPATH"
  '';

  qmakeFlags = [
    "EXIV2PATH=${exiv2.dev}/include/exiv2"
    "OPENEXRDIR=${openexr}/include/OpenEXR"
    "FFTW3DIR=${fftwSinglePrec.dev}/include"
    "LIBTIFFDIR=${libtiff.dev}/include"
  ];

  meta = {
    homepage = http://qtpfsgui.sourceforge.net/;
    description = "Qtpfsqui, a graphical application for high dynamic range (HDR) imaging";

    longDescription =
      '' Qtpfsgui is an open source graphical user interface application that
         aims to provide a workflow for high dynamic range (HDR) imaging.
      '';

    license = stdenv.lib.licenses.gpl2Plus;

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


{ stdenv, fetchurl }:

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

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

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

Use pkgconfig and a shorter sourceforge url

{ stdenv, fetchurl, pkgconfig }:

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

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

  buildInputs = [ pkgconfig ];

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


# From an end-user configuration file (`configuration'), build a NixOS
# configuration object (`config') from which we can retrieve option
# values.

{ configuration
, system ? builtins.currentSystem
, nixpkgs ? import ./from-env.nix "NIXPKGS" /etc/nixos/nixpkgs
, pkgs ? import nixpkgs {inherit system;}
}:

rec {
  inherit nixpkgs pkgs;

  configComponents = [
    configuration
    ./check-config.nix
  ] ++ (import ../modules/module-list.nix);

  config_ =
    pkgs.lib.fixOptionSets
      pkgs.lib.mergeOptionSets
      { inherit pkgs; } configComponents;

  optionDeclarations =
    pkgs.lib.fixOptionSetsFun
      pkgs.lib.filterOptionSets
      { inherit pkgs; } configComponents
      config_;

  # Optionally check wether all config values have corresponding
  # option declarations.
  config = pkgs.checker config_
    config_.environment.checkConfigurationOptions
    optionDeclarations config_;
}

Use "definitionsOf" & "fixableDeclarationsOf": Hide implementation details.

# From an end-user configuration file (`configuration'), build a NixOS
# configuration object (`config') from which we can retrieve option
# values.

{ configuration
, system ? builtins.currentSystem
, nixpkgs ? import ./from-env.nix "NIXPKGS" /etc/nixos/nixpkgs
, pkgs ? import nixpkgs {inherit system;}
}:

rec {
  inherit nixpkgs pkgs;

  configComponents = [
    configuration
    ./check-config.nix
  ] ++ (import ../modules/module-list.nix);

  config_ =
    pkgs.lib.definitionsOf configComponents {
      inherit pkgs;
    };

  # "fixableDeclarationsOf" is used instead of "declarationsOf" because some
  # option default values may depends on the definition of other options.
  optionDeclarations =
    pkgs.lib.fixableDeclarationsOf configComponents {
      inherit pkgs;
    } config_;

  # Optionally check wether all config values have corresponding
  # option declarations.
  config = pkgs.checker config_
    config_.environment.checkConfigurationOptions
    optionDeclarations config_;
}


{ stdenv, fetchurl, buildPythonPackage, blivet
# Propagated to blivet
, useNixUdev ? null, udevSoMajor ? null
}:

let
  blivetOverrides = stdenv.lib.filterAttrs (k: v: v != null) {
    inherit useNixUdev udevSoMajor;
  };
in buildPythonPackage rec {
  name = "nixpart-${version}";
  version = "0.2.0";

  src = fetchurl {
    url = "https://github.com/aszlig/nixpart/archive/v${version}.tar.gz";
    sha256 = "1z94h76jn9igksgr84wwbi03fjamwb15hg432x189kgsld1ark4n";
  };

  propagatedBuildInputs = [ (blivet.override blivetOverrides) ];

  doCheck = false;

  meta = {
    description = "NixOS storage manager/partitioner";
    license = stdenv.lib.licenses.gpl2Plus;
    maintainers = [ stdenv.lib.maintainers.aszlig ];
  };
}

Update to new version 0.2.1.

{ stdenv, fetchurl, buildPythonPackage, blivet
# Propagated to blivet
, useNixUdev ? null, udevSoMajor ? null
}:

let
  blivetOverrides = stdenv.lib.filterAttrs (k: v: v != null) {
    inherit useNixUdev udevSoMajor;
  };
in buildPythonPackage rec {
  name = "nixpart-${version}";
  version = "0.2.1";

  src = fetchurl {
    url = "https://github.com/aszlig/nixpart/archive/v${version}.tar.gz";
    sha256 = "03v2n2cf9cq9brnxx3yx26nsm3fkgdhmkcm52s89g33c1rmzzgbk";
  };

  propagatedBuildInputs = [ (blivet.override blivetOverrides) ];

  doCheck = false;

  meta = {
    description = "NixOS storage manager/partitioner";
    license = stdenv.lib.licenses.gpl2Plus;
    maintainers = [ stdenv.lib.maintainers.aszlig ];
  };
}


{stdenv, fetchurl, openssl, perl}:

stdenv.mkDerivation {
  name = "ldns-1.6.11";
  src = fetchurl {
    url = "http://www.nlnetlabs.nl/downloads/ldns/ldns-1.6.11.tar.gz";
    sha256 = "1248c9gkgfmjdmpp3lfd56vvln94ii54kbxa5iykxvcxivmbi4b8";
  };

  patchPhase = ''
    sed -i 's,\$(srcdir)/doc/doxyparse.pl,perl $(srcdir)/doc/doxyparse.pl,' Makefile.in
  '';

  buildInputs = [ openssl perl ];

  configureFlags = [ "--with-ssl=${openssl}" ];

  meta = {
    description = "Library with the aim of simplifying DNS programming in C";
    license = "BSD";
    homepage = "http://www.nlnetlabs.nl/projects/ldns/";
  };
}

Update to 1.6.16 and enable drill.

{stdenv, fetchurl, openssl, perl}:

stdenv.mkDerivation rec {
  name = "ldns-1.6.16";

  src = fetchurl {
    url = "http://www.nlnetlabs.nl/downloads/ldns/${name}.tar.gz";
    sha256 = "15gn9m95r6sq2n55dw4r87p2aljb5lvy1w0y0br70wbr0p5zkci4";
  };

  patchPhase = ''
    sed -i 's,\$(srcdir)/doc/doxyparse.pl,perl $(srcdir)/doc/doxyparse.pl,' Makefile.in
  '';

  buildInputs = [ openssl perl ];

  configureFlags = [ "--with-ssl=${openssl}" "--with-drill" ];

  meta = {
    description = "Library with the aim of simplifying DNS programming in C";
    license = "BSD";
    homepage = "http://www.nlnetlabs.nl/projects/ldns/";
  };
}


{ stdenv, pass, fetchFromGitHub }:
stdenv.mkDerivation {
  name = "pass-otp";

  src = fetchFromGitHub {
    owner = "tadfisher";
    repo = "pass-otp";
    rev = "f2feb3082324a91089782af9b7fbb71d34aa213d";
    sha256 = "0iklvcfgw1320dggdr02lq3bc7xvnd2934l1w9kkjpbsfmhs955c";
  };

  buildInputs = [ pass ];

  installPhase = ''
    make PREFIX=$out install
  '';

  meta = with stdenv.lib; {
    description = "A pass extension for managing one-time-password (OTP) tokens";
    homepage = https://github.com/tadfisher/pass-otp;
    license = licenses.gpl3;
    maintainers = with maintainers; [ jwiegley ];
    platforms = platforms.unix;
  };
}

Change oathtool reference into an absolute path

{ stdenv, pass, fetchFromGitHub, oathToolkit }:
stdenv.mkDerivation {
  name = "pass-otp";

  src = fetchFromGitHub {
    owner = "tadfisher";
    repo = "pass-otp";
    rev = "f2feb3082324a91089782af9b7fbb71d34aa213d";
    sha256 = "0iklvcfgw1320dggdr02lq3bc7xvnd2934l1w9kkjpbsfmhs955c";
  };

  buildInputs = [ pass oathToolkit ];

  patchPhase = ''
    sed -i -e 's|OATH=\$(which oathtool)|OATH=${oathToolkit}/bin/oathtool|' otp.bash
  '';

  installPhase = ''
    make PREFIX=$out install
  '';

  meta = with stdenv.lib; {
    description = "A pass extension for managing one-time-password (OTP) tokens";
    homepage = https://github.com/tadfisher/pass-otp;
    license = licenses.gpl3;
    maintainers = with maintainers; [ jwiegley ];
    platforms = platforms.unix;
  };
}


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

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

  programs.direnv = {
    enable = true;
    nix-direnv = {
      enable = true;
      enableFlakes = true;
    };
  };

  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";
  };
}

Add jsonnet package in all hosts

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

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

  programs.direnv = {
    enable = true;
    nix-direnv = {
      enable = true;
      enableFlakes = true;
    };
  };

  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, fetchurl, cmake, boost, ffmpeg }:

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

  src = fetchurl {
    url = "https://github.com/acoustid/chromaprint/releases/download/v${version}/${name}.tar.gz";
    sha256 = "10kz8lncal4s2rp2rqpgc6xyjp0jzcrihgkx7chf127vfs5n067a";
  };

  nativeBuildInputs = [ cmake ];

  buildInputs = [ boost ffmpeg ];

  cmakeFlags = [ "-DBUILD_EXAMPLES=ON" ];

  meta = with stdenv.lib; {
    homepage = https://acoustid.org/chromaprint;
    description = "AcoustID audio fingerprinting library";
    maintainers = with maintainers; [ ehmry ];
    license = licenses.lgpl21Plus;
    platforms = platforms.linux;
  };
}

Revert "chromaprint: 1.3.2 -> 1.4.3"

{ stdenv, fetchurl, cmake, boost, ffmpeg }:

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

  src = fetchurl {
    url = "http://bitbucket.org/acoustid/chromaprint/downloads/${name}.tar.gz";
    sha256 = "0lln8dh33gslb9cbmd1hcv33pr6jxdwipd8m8gbsyhksiq6r1by3";
  };

  nativeBuildInputs = [ cmake ];

  buildInputs = [ boost ffmpeg ];

  cmakeFlags = [ "-DBUILD_EXAMPLES=ON" ];

  meta = with stdenv.lib; {
    homepage = https://acoustid.org/chromaprint;
    description = "AcoustID audio fingerprinting library";
    maintainers = with maintainers; [ ehmry ];
    license = licenses.lgpl21Plus;
    platforms = platforms.linux;
  };
}


{ stdenv, fetchurl, kernel, perl, makeWrapper }:

assert stdenv.isLinux;

stdenv.mkDerivation {
  name = "blcr-0.8.4-${kernel.version}";

  src = fetchurl {
    url = https://ftg.lbl.gov/assets/projects/CheckpointRestart/downloads/blcr-0.8.4.tar.gz;
    sha256 = "d851da66627d9212ac37bc9ea2aba40008ff2dc51d45dbd395ca2e403c3d78cf";
  };

  buildInputs = [ perl makeWrapper ];

  preConfigure = ''
    configureFlagsArray=(
      --with-linux=${kernel}/lib/modules/${kernel.modDirVersion}/build
      --with-kmod-dir=$out/lib/modules/${kernel.modDirVersion}
      --with-system-map=${kernel}/System.map
    )
  '';

  postInstall = ''
    for prog in "$out/bin/"*
    do
      wrapProgram "$prog" --prefix LD_LIBRARY_PATH ":" "$out/lib"
    done
  '';

  meta = {
    description = "Berkeley Lab Checkpoint/Restart for Linux (BLCR)";
    homepage = https://ftg.lbl.gov/projects/CheckpointRestart/;
    license = "GPL2";
  };
}

Add myself as mantainer. Add platforms.

{ stdenv, fetchurl, kernel, perl, makeWrapper }:

assert stdenv.isLinux;

stdenv.mkDerivation {
  name = "blcr-0.8.4-${kernel.version}";

  src = fetchurl {
    url = https://ftg.lbl.gov/assets/projects/CheckpointRestart/downloads/blcr-0.8.4.tar.gz;
    sha256 = "d851da66627d9212ac37bc9ea2aba40008ff2dc51d45dbd395ca2e403c3d78cf";
  };

  buildInputs = [ perl makeWrapper ];

  preConfigure = ''
    configureFlagsArray=(
      --with-linux=${kernel}/lib/modules/${kernel.modDirVersion}/build
      --with-kmod-dir=$out/lib/modules/${kernel.modDirVersion}
      --with-system-map=${kernel}/System.map
    )
  '';

  postInstall = ''
    for prog in "$out/bin/"*
    do
      wrapProgram "$prog" --prefix LD_LIBRARY_PATH ":" "$out/lib"
    done
  '';

  meta = {
    description = "Berkeley Lab Checkpoint/Restart for Linux (BLCR)";
    homepage = https://ftg.lbl.gov/projects/CheckpointRestart/;
    license = "GPL2";
    platforms = stdenv.lib.platforms.linux;
    maintainers = with stdenv.lib.maintainers; [
      z77z
    ];
  };
}


# ALSA sound support.
{ config, pkgs, ... }:

with pkgs.lib;

let

  inherit (pkgs) alsaUtils;

  soundState = "/var/lib/alsa/asound.state";

in

{

  ###### interface

  options = {

    sound = {

      enable = mkOption {
        default = true;
        description = ''
          Whether to enable ALSA sound.
        '';
        merge = mergeEnableOption;
      };

      enableOSSEmulation = mkOption {
        default = true;
        description = ''
          Whether to enable ALSA OSS emulation (with certain cards sound mixing may not work!).
        '';
      };

    };

  };

  ###### implementation

  config = mkIf config.sound.enable {

    environment.systemPackages = [ alsaUtils ];

    # ALSA provides a udev rule for restoring volume settings.
    services.udev.packages = [ alsaUtils ];

    boot.kernelModules = optional config.sound.enableOSSEmulation "snd_pcm_oss";

    systemd.services."alsa-store" =
      { description = "Store Sound Card State";
        wantedBy = [ "shutdown.target" ];
        before = [ "shutdown.target" ];
        unitConfig.DefaultDependencies = "no";
        serviceConfig.Type = "oneshot";
        serviceConfig.ExecStart = "${alsaUtils}/sbin/alsactl store --ignore";
        serviceConfig.ExecStartPre = "${pkgs.coreutils}/bin/mkdir -p /var/lib/alsa";
      };

  };

}

Fix saving the ALSA sound card state

# ALSA sound support.
{ config, pkgs, ... }:

with pkgs.lib;

let

  inherit (pkgs) alsaUtils;

  soundState = "/var/lib/alsa/asound.state";

in

{

  ###### interface

  options = {

    sound = {

      enable = mkOption {
        default = true;
        description = ''
          Whether to enable ALSA sound.
        '';
        merge = mergeEnableOption;
      };

      enableOSSEmulation = mkOption {
        default = true;
        description = ''
          Whether to enable ALSA OSS emulation (with certain cards sound mixing may not work!).
        '';
      };

    };

  };

  ###### implementation

  config = mkIf config.sound.enable {

    environment.systemPackages = [ alsaUtils ];

    # ALSA provides a udev rule for restoring volume settings.
    services.udev.packages = [ alsaUtils ];

    boot.kernelModules = optional config.sound.enableOSSEmulation "snd_pcm_oss";

    systemd.services."alsa-store" =
      { description = "Store Sound Card State";
        wantedBy = [ "multi-user.target" ];
        unitConfig.RequiresMountsFor = "/var/lib/alsa";
        serviceConfig = {
          Type = "oneshot";
          RemainAfterExit = true;
          ExecStart = "${pkgs.coreutils}/bin/mkdir -p /var/lib/alsa";
          ExecStop = "${alsaUtils}/sbin/alsactl store --ignore";
        };
      };

  };

}


{infrastructure}:

{
  tomcat = [ infrastructure.test1 infrastructure.test2 ];
  axis2 = [ infrastructure.test1 ];

  HelloService = [ infrastructure.test1 ];
  HelloWorldService = [ infrastructure.test1 ];
  HelloWorld = [ infrastructure.test2 ];
}

Fix extreme reuse test case

{infrastructure}:

{
  tomcat = [ infrastructure.test1 infrastructure.test2 ];
  axis2 = [ infrastructure.test2 ];

  HelloService = [ infrastructure.test2 ];
  HelloWorldService = [ infrastructure.test2 ];
  HelloWorld = [ infrastructure.test1 ];
}


{ stdenv, fetchurl }:

stdenv.mkDerivation {
  name = "patchutils-0.3.0";

  src = fetchurl {
    url = http://cyberelk.net/tim/data/patchutils/stable/patchutils-0.3.0.tar.bz2;
    sha256 = "08jzvprhpcgwvx0xlkwc8dbdd9ilvwyr3cwnq96xmbfipch69yi7";
  };

  meta = {
    description = "Tools to manipulate patch files";
    homepage = http://cyberelk.net/tim/software/patchutils;
    license = "GPLv2";
    executables = [ "combinediff" "dehtmldiff" "editdiff" "espdiff"
      "filterdiff" "fixcvsdiff" "flipdiff" "grepdiff" "interdiff" "lsdiff"
      "recountdiff" "rediff" "splitdiff" "unwrapdiff" ];
  };
}

Update to new upstream version 0.3.3.

{ stdenv, fetchurl }:

stdenv.mkDerivation rec {
  name = "patchutils-0.3.3";

  src = fetchurl {
    url = "http://cyberelk.net/tim/data/patchutils/stable/${name}.tar.xz";
    sha256 = "0g5df00cj4nczrmr4k791l7la0sq2wnf8rn981fsrz1f3d2yix4i";
  };

  meta = {
    description = "Tools to manipulate patch files";
    homepage = http://cyberelk.net/tim/software/patchutils;
    license = "GPLv2";
    executables = [ "combinediff" "dehtmldiff" "editdiff" "espdiff"
      "filterdiff" "fixcvsdiff" "flipdiff" "grepdiff" "interdiff" "lsdiff"
      "recountdiff" "rediff" "splitdiff" "unwrapdiff" ];
  };
}


{stdenv, fetchurl, pkgconfig, gtk, libglade, libgnomeprint,
libgnomeprintui, libgnomecanvas, fribidi, libpng, popt, libgsf,
enchant, wv
}:

stdenv.mkDerivation {
  name = "abiword-2.6.6";
  src = fetchurl {
    url = http://www.abisource.org/downloads/abiword/2.6.6/source/abiword-2.6.6.tar.gz;
    sha256 = "1cgi6l3wd82vgni4wcqasyl2rvxwffliyqgbwvzv0nn99wasg5gx";
  };

  buildInputs = [pkgconfig gtk libglade libgnomeprint libgnomeprintui
                 libgnomecanvas fribidi libpng popt libgsf enchant wv
                ];
}

Update abiword. Unfortunately, it does not help to build it. The problem is with popt and gcc-g++-4.3

{stdenv, fetchurl, pkgconfig, gtk, libglade, libgnomeprint,
libgnomeprintui, libgnomecanvas, fribidi, libpng, popt, libgsf,
enchant, wv
}:

stdenv.mkDerivation {
  name = "abiword-2.6.8";
  src = fetchurl {
    url = http://www.abisource.org/downloads/abiword/2.6.8/source/abiword-2.6.8.tar.gz;
    sha256 = "14vfp668srjgy6wd22h4a93safp1iyfwhdr6y0sb751xl46nlrdn";
  };

  buildInputs = [pkgconfig gtk libglade libgnomeprint libgnomeprintui
                 libgnomecanvas fribidi libpng popt libgsf enchant wv
                ];
}


{stdenv, fetchurl, SDL, mesa, zlib, libpng, libvorbis, libmikmod, SDL_sound } :

stdenv.mkDerivation rec {
  name = "gltron-0.70";
  src = fetchurl {
    url = "mirror://sourceforge/gltron/${name}-source.tar.gz";
    sha256 = "e0c8ebb41a18a1f8d7302a9c2cb466f5b1dd63e9a9966c769075e6b6bdad8bb0";
  };

  patches = [ ./gentoo-prototypes.patch ];

  # The build fails, unless we disable the default -Wall -Werror
  configureFlags = "--disable-warn";

  buildInputs = [ SDL mesa zlib libpng libvorbis libmikmod SDL_sound ];

  meta = {
    homepage = http://www.gltron.org/;
    description = "Game based on the movie Tron";
    license = stdenv.lib.licenses.gpl2Plus;
    maintainers = with stdenv.lib.maintainers; [viric];
    platforms = with stdenv.lib.platforms; linux;
    broken = true; # see http://sourceforge.net/p/gltron/bugs/15
  };
}

Fix gltron. Sinterklaas present for iElectric.

{stdenv, fetchurl, SDL, mesa, zlib, libpng, libvorbis, libmikmod, SDL_sound } :

stdenv.mkDerivation rec {
  name = "gltron-0.70";
  src = fetchurl {
    url = "mirror://sourceforge/gltron/${name}-source.tar.gz";
    sha256 = "e0c8ebb41a18a1f8d7302a9c2cb466f5b1dd63e9a9966c769075e6b6bdad8bb0";
  };

  patches = [ ./gentoo-prototypes.patch ];

  postPatch = ''
     # Fix http://sourceforge.net/p/gltron/bugs/15
     sed -i /__USE_MISC/d lua/src/lib/liolib.c
  '';

  # The build fails, unless we disable the default -Wall -Werror
  configureFlags = "--disable-warn";

  buildInputs = [ SDL mesa zlib libpng libvorbis libmikmod SDL_sound ];

  meta = {
    homepage = http://www.gltron.org/;
    description = "Game based on the movie Tron";
    license = stdenv.lib.licenses.gpl2Plus;
    maintainers = with stdenv.lib.maintainers; [viric];
    platforms = with stdenv.lib.platforms; linux;
  };
}


let requiredVersion = import ./lib/minver.nix; in

if ! builtins ? nixVersion || builtins.compareVersions requiredVersion builtins.nixVersion == 1 then

  abort ''

    This version of Nixpkgs requires Nix >= ${requiredVersion}, please upgrade:

    - If you are running NixOS, `nixos-rebuild' can be used to upgrade your system.

    - Alternatively, with Nix > 2.0 `nix upgrade-nix' can be used to imperatively
      upgrade Nix. You may use `nix-env --version' to check which version you have.

    - If you installed Nix using the install script (https://nixos.org/nix/install),
      it is safe to upgrade by running it again:

          curl https://nixos.org/nix/install | sh

    For more information, please see the NixOS release notes at
    https://nixos.org/nixos/manual or locally at
    ${toString ./doc/manual/release-notes}.

    If you need further help, see https://nixos.org/nixos/support.html
  ''

else

  import ./pkgs/top-level/impure.nix

Fix local path to release notes in error message

let requiredVersion = import ./lib/minver.nix; in

if ! builtins ? nixVersion || builtins.compareVersions requiredVersion builtins.nixVersion == 1 then

  abort ''

    This version of Nixpkgs requires Nix >= ${requiredVersion}, please upgrade:

    - If you are running NixOS, `nixos-rebuild' can be used to upgrade your system.

    - Alternatively, with Nix > 2.0 `nix upgrade-nix' can be used to imperatively
      upgrade Nix. You may use `nix-env --version' to check which version you have.

    - If you installed Nix using the install script (https://nixos.org/nix/install),
      it is safe to upgrade by running it again:

          curl https://nixos.org/nix/install | sh

    For more information, please see the NixOS release notes at
    https://nixos.org/nixos/manual or locally at
    ${toString ./nixos/doc/manual/release-notes}.

    If you need further help, see https://nixos.org/nixos/support.html
  ''

else

  import ./pkgs/top-level/impure.nix


let
  pkgs = import <nixpkgs> {};

  log_level = "info";
in
pkgs.mkShell {
  buildInputs = with pkgs; [
    rustc cargo rustfmt rls cargo-outdated clippy

    # Needed by cargo dependencies.
    cmake gcc zlib pkgconfig openssl

    # wgpu graphics dependencies
    vulkan-loader vulkan-tools
    xorg.libXcursor xorg.libXi xorg.libXrandr

    # SPIR-V shader compiler
    shaderc

    # Linker
    lld

    # Map editor
    tiled
  ];

  shellHook = ''
    # Dynamic linking for Vulkan stuff for wgpu graphics
    export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${
      with pkgs; pkgs.stdenv.lib.makeLibraryPath [ vulkan-loader ]
    }"

    # Run clippy without showing stuff I don't care about.
    alias clippy="cargo clippy -- -A clippy::cast_lossless"

    # FIXME: Current (2020-04-18) NixOS cargo-outdated is broken, you have to
    # do this stupid thing. Remove alias when it's fixed.
    alias cargo-outdated="cargo-outdated outdated"
  '';

  RUST_BACKTRACE = "1";
  RUSTFLAGS = "-C link-arg=-fuse-ld=lld";
  RUST_LOG = "calx-ecs=${log_level},vitral=${log_level},calx=${log_level},display=${log_level},world=${log_level},magog=${log_level}";
}

Remove cargo-outdated kludge, seems to work now?

let
  pkgs = import <nixpkgs> {};

  log_level = "info";
in
pkgs.mkShell {
  buildInputs = with pkgs; [
    rustc cargo rustfmt rls cargo-outdated clippy

    # Needed by cargo dependencies.
    cmake gcc zlib pkgconfig openssl

    # wgpu graphics dependencies
    vulkan-loader vulkan-tools
    xorg.libXcursor xorg.libXi xorg.libXrandr

    # SPIR-V shader compiler
    shaderc

    # Linker
    lld

    # Map editor
    tiled
  ];

  shellHook = ''
    # Dynamic linking for Vulkan stuff for wgpu graphics
    export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${
      with pkgs; pkgs.stdenv.lib.makeLibraryPath [ vulkan-loader ]
    }"

    # Run clippy without showing stuff I don't care about.
    alias clippy="cargo clippy -- -A clippy::cast_lossless"
  '';

  RUST_BACKTRACE = "1";
  RUSTFLAGS = "-C link-arg=-fuse-ld=lld";
  RUST_LOG = "calx-ecs=${log_level},vitral=${log_level},calx=${log_level},display=${log_level},world=${log_level},magog=${log_level}";
}


{ lib, stdenv, fetchFromGitHub, pkg-config, zlib, rdkafka, yajl, avro-c, libserdes }:

stdenv.mkDerivation rec {
  pname = "kafkacat";

  version = "1.7.0";

  src = fetchFromGitHub {
    owner = "edenhill";
    repo = "kafkacat";
    rev = version;
    sha256 = "sha256-koDhj/RQc9fhfqjrJylhURw6tppPELhLlBGbNVJsii8=";
  };

  nativeBuildInputs = [ pkg-config ];

  buildInputs = [ zlib rdkafka yajl avro-c libserdes ];

  preConfigure = ''
    patchShebangs ./configure
  '';

  meta = with lib; {
    description = "A generic non-JVM producer and consumer for Apache Kafka";
    homepage = "https://github.com/edenhill/kafkacat";
    license = licenses.bsd2;
    platforms = platforms.linux ++ platforms.darwin;
    maintainers = with maintainers; [ nyarly ];
  };
}

Revert "kafkacat: 1.6.0 -> 1.7.0"

{ lib, stdenv, fetchFromGitHub, pkg-config, zlib, rdkafka, yajl, avro-c, libserdes }:

stdenv.mkDerivation rec {
  pname = "kafkacat";

  version = "1.6.0";

  src = fetchFromGitHub {
    owner = "edenhill";
    repo = "kafkacat";
    rev = version;
    sha256 = "0z3bw00s269myfd1xqksjyznmgp74xfs09xqlq347adsgby3cmfs";
  };

  nativeBuildInputs = [ pkg-config ];

  buildInputs = [ zlib rdkafka yajl avro-c libserdes ];

  preConfigure = ''
    patchShebangs ./configure
  '';

  meta = with lib; {
    description = "A generic non-JVM producer and consumer for Apache Kafka";
    homepage = "https://github.com/edenhill/kafkacat";
    license = licenses.bsd2;
    platforms = platforms.linux ++ platforms.darwin;
    maintainers = with maintainers; [ nyarly ];
  };
}


with import <nixpkgs> { };
let
  hsPkgs = haskell.packages.ghc801;
in
  haskell.lib.buildStackProject {
     name = "cardano-sl";
     ghc = hsPkgs.ghc;
     buildInputs =
       [ zlib glib git cabal-install openssh autoreconfHook stack openssl
         sshpass gmp ];
  }

Add haddock fix for nix

with import <nixpkgs> { };
let
  hsPkgs = haskell.packages.ghc801;
in
  haskell.lib.buildStackProject {
     name = "cardano-sl";
     ghc = hsPkgs.ghc;
     buildInputs =
       [ zlib glib git cabal-install openssh autoreconfHook stack openssl
         sshpass gmp ];
     LANG = "en_US.UTF-8";
  }


{ lib, buildFHSUserEnv }:

let
  pio-pkgs = pkgs:
    let
      python = pkgs.python3.override {
        packageOverrides = self: super: {
          platformio = self.callPackage ./core.nix { };
        };
      };
    in (with pkgs; [
      zlib
      git
    ]) ++ (with python.pkgs; [
      python
      setuptools
      pip
      bottle
      platformio
    ]);

in buildFHSUserEnv {
  name = "platformio";

  targetPkgs = pio-pkgs;
  multiPkgs = pio-pkgs;

  meta = with lib; {
    description = "An open source ecosystem for IoT development";
    homepage = "https://platformio.org";
    maintainers = with maintainers; [ mog ];
    license = licenses.asl20;
    platforms = with platforms; linux;
  };

  extraInstallCommands = ''
    ln -s $out/bin/platformio $out/bin/pio
  '';

  runScript = "platformio";
}

Put udev rules into package output

{ lib, buildFHSUserEnv, fetchFromGitHub }:

let
  pio-pkgs = pkgs:
    let
      python = pkgs.python3.override {
        packageOverrides = self: super: {
          platformio = self.callPackage ./core.nix { };
        };
      };
    in (with pkgs; [
      zlib
      git
    ]) ++ (with python.pkgs; [
      python
      setuptools
      pip
      bottle
      platformio
    ]);

  src = fetchFromGitHub {
    owner = "platformio";
    repo = "platformio-core";
    rev = "v4.3.4";
    sha256 = "0vf2j79319ypr4yrdmx84853igkb188sjfvlxgw06rlsvsm3kacq";
  };

in buildFHSUserEnv {
  name = "platformio";

  targetPkgs = pio-pkgs;
  multiPkgs = pio-pkgs;

  meta = with lib; {
    description = "An open source ecosystem for IoT development";
    homepage = "https://platformio.org";
    maintainers = with maintainers; [ mog ];
    license = licenses.asl20;
    platforms = with platforms; linux;
  };

  extraInstallCommands = ''
    mkdir -p $out/lib/udev/rules.d

    ln -s $out/bin/platformio $out/bin/pio
    ln -s ${src}/scripts/99-platformio-udev.rules $out/lib/udev/rules.d/99-platformio-udev.rules
  '';

  runScript = "platformio";
}


{ lib, buildPythonPackage, fetchPypi
, pbr, ldap, fixtures, testresources, testtools }:

buildPythonPackage rec {
  name = "ldappool-${version}";
  version = "2.3.0";

  src = fetchPypi {
    pname = "ldappool";
    inherit version;
    sha256 = "899d38e891372981166350c813ff5ce2ad8ac383311edccda8102362c1d60952";
  };

  nativeBuildInputs = [ pbr ];

  propagatedBuildInputs = [ ldap ];

  checkInputs = [ fixtures testresources testtools ];

  meta = with lib; {
    description = "A simple connector pool for python-ldap";
    homepage = https://git.openstack.org/cgit/openstack/ldappool;
    license = licenses.mpl20;
  };
}

Revert "python: ldappool: 2.2.0 -> 2.3.0"

{ lib, buildPythonPackage, fetchPypi
, pbr, ldap, fixtures, testresources, testtools }:

buildPythonPackage rec {
  name = "ldappool-${version}";
  version = "2.2.0";

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

  nativeBuildInputs = [ pbr ];

  propagatedBuildInputs = [ ldap ];

  checkInputs = [ fixtures testresources testtools ];

  meta = with lib; {
    description = "A simple connector pool for python-ldap";
    homepage = https://git.openstack.org/cgit/openstack/ldappool;
    license = licenses.mpl20;
  };
}


{ stdenv, callPackage }:
callPackage ./makeRustcDerivation.nix {
  shortVersion = "1.0.0-dev";
  isRelease = false;
  # src rev for master on 2015-04-15
  srcRev = "a691f1eefea586f154700be6ee1b991158f82b7f";
  srcSha = "1afypvxahhwhva9rssagm2q08wgidv6xcjrx85lqwzy6abyl1hsz";
  snapshotHashLinux686 = "1ef82402ed16f5a6d2f87a9a62eaa83170e249ec";
  snapshotHashLinux64 = "ef2154372e97a3cb687897d027fd51c8f2c5f349";
  snapshotHashDarwin686 = "0310b1a970f2da7e61770fd14dbbbdca3b518234";
  snapshotHashDarwin64 = "5f35d9c920b8083a7420ef8cf5b00d5ef3085dfa";
  snapshotDate = "2015-03-27";
  snapshotRev = "5520801";
  patches = [
    ./patches/head.patch
  ] ++ stdenv.lib.optional stdenv.needsPax ./patches/grsec.patch;
}

Update from 2015-04-15 -> 2015-05-09

{ stdenv, callPackage }:
callPackage ./makeRustcDerivation.nix {
  shortVersion = "1.0.0-dev";
  isRelease = false;
  # src rev for master on 2015-05-09
  srcRev = "95400c51c31877ea4699adc051477edccb5cfbca";
  srcSha = "1ldgc5nd42pcbr650rpyvpnc8h6bky6gmb116fwy1g6x2ql66djw";
  snapshotHashLinux686 = "0bc8cffdce611fb71fd7d3d8e7cdbfaf748a4f16";
  snapshotHashLinux64 = "94089740e48167c5975c92c139ae9c286764012f";
  snapshotHashDarwin686 = "54cc35e76497e6e94fddf38d6e40e9d168491ddb";
  snapshotHashDarwin64 = "43a1c1fba0d1dfee4c2ca310d506f8f5f51b3f6f";
  snapshotDate = "2015-04-27";
  snapshotRev = "857ef6e";
  patches = [
    ./patches/head.patch
  ] ++ stdenv.lib.optional stdenv.needsPax ./patches/grsec.patch;
}


{ lib, stdenv
, fetchurl
, makeWrapper
, opencl-headers
, ocl-icd
, xxHash
}:

stdenv.mkDerivation rec {
  pname   = "hashcat";
  version = "6.1.1";

  src = fetchurl {
    url = "https://hashcat.net/files/hashcat-${version}.tar.gz";
    sha256 = "104z63m7lqbb0sdrxhf9yi15l4a9zwf9m6zs9dbb3gf0nfxl1h9r";
  };

  nativeBuildInputs = [ makeWrapper ];
  buildInputs = [ opencl-headers xxHash ];

  makeFlags = [
    "PREFIX=${placeholder "out"}"
    "COMPTIME=1337"
    "VERSION_TAG=${version}"
    "USE_SYSTEM_OPENCL=1"
    "USE_SYSTEM_XXHASH=1"
  ];

  postFixup = ''
    wrapProgram $out/bin/hashcat --prefix LD_LIBRARY_PATH : ${ocl-icd}/lib
  '';

  meta = with lib; {
    description = "Fast password cracker";
    homepage    = "https://hashcat.net/hashcat/";
    license     = licenses.mit;
    platforms   = platforms.linux;
    maintainers = with maintainers; [ kierdavis zimbatm ];
  };
}

Fix OpenCL support for ROCm

{ lib, stdenv
, fetchurl
, makeWrapper
, opencl-headers
, ocl-icd
, xxHash
}:

stdenv.mkDerivation rec {
  pname   = "hashcat";
  version = "6.1.1";

  src = fetchurl {
    url = "https://hashcat.net/files/hashcat-${version}.tar.gz";
    sha256 = "104z63m7lqbb0sdrxhf9yi15l4a9zwf9m6zs9dbb3gf0nfxl1h9r";
  };

  nativeBuildInputs = [ makeWrapper ];
  buildInputs = [ opencl-headers xxHash ];

  makeFlags = [
    "PREFIX=${placeholder "out"}"
    "COMPTIME=1337"
    "VERSION_TAG=${version}"
    "USE_SYSTEM_OPENCL=1"
    "USE_SYSTEM_XXHASH=1"
  ];

  preFixup = ''
    for f in $out/share/hashcat/OpenCL/*.cl; do
      sed "s|#include \"\(.*\)\"|#include \"$out/share/hashcat/OpenCL/\1\"|g" -i "$f"
    done
  '';

  postFixup = ''
    wrapProgram $out/bin/hashcat --prefix LD_LIBRARY_PATH : ${ocl-icd}/lib
  '';

  meta = with lib; {
    description = "Fast password cracker";
    homepage    = "https://hashcat.net/hashcat/";
    license     = licenses.mit;
    platforms   = platforms.linux;
    maintainers = with maintainers; [ kierdavis zimbatm ];
  };
}


# 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.25";
    url = "http://commondatastorage.googleapis.com/chromium-browser-official/chromium-24.0.1312.25.tar.bz2";
    sha256 = "1d2wnv0pmvja1vwqmccngajwgf9kwz55bhid43k1db7yczi591fr";
  };
  stable = {
    version = "23.0.1271.91";
    url = "http://commondatastorage.googleapis.com/chromium-browser-official/chromium-23.0.1271.91.tar.bz2";
    sha256 = "00avyc8bszkb99jq399jr3h1ia7lw68msszvrdhl5rh052z1lp9q";
  };
}

Update channels to stable v23.0.1271.95.

# 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.27";
    url = "http://commondatastorage.googleapis.com/chromium-browser-official/chromium-24.0.1312.27.tar.bz2";
    sha256 = "0w3yq3c1kf3z6k4xdgmny7l5yxyl8zidq698nsf4fm70pgav2zj1";
  };
  stable = {
    version = "23.0.1271.95";
    url = "http://commondatastorage.googleapis.com/chromium-browser-official/chromium-23.0.1271.95.tar.bz2";
    sha256 = "0g7ig49790szn8kal8jkf97qbm2qhn2bprpbq2ylq4zzvwhps29h";
  };
}


{ pkgs ? import ../nix/nixpkgs.nix, compiler ? null
, forShell ? pkgs.lib.inNixShell, hoogle ? forShell, withSwiftshader ? false
, buildProfiling ? false, buildInstrumented ? false, safeVulkanFFI ? false }:

let
  haskellPackages = import ../nix/haskell-packages.nix {
    inherit pkgs compiler hoogle buildProfiling buildInstrumented safeVulkanFFI;
  };
in if forShell then
  haskellPackages.shellFor ({
    packages = p: [ p.vulkan-examples ];
    buildInputs = with pkgs;
      [ vulkan-tools-lunarg vulkan-validation-layers shaderc ]
      ++ pkgs.lib.optional withSwiftshader vulkan-extension-layer
      ++ pkgs.lib.optional buildProfiling [
        haskellPackages.eventlog2html
        haskellPackages.hs-speedscope
        haskellPackages.opentelemetry-extra
        pkgs.tracy
        pkgs.gdb
      ];
    withHoogle = hoogle;
  } // pkgs.lib.optionalAttrs withSwiftshader {
    VK_ICD_FILENAMES =
      "${pkgs.swiftshader}/share/vulkan/icd.d/vk_swiftshader_icd.json";
    VK_INSTANCE_LAYERS = "VK_LAYER_KHRONOS_timeline_semaphore";
  })
else
  haskellPackages.vulkan-examples

Add linuxPackages.perf to profiling utils

{ pkgs ? import ../nix/nixpkgs.nix, compiler ? null
, forShell ? pkgs.lib.inNixShell, hoogle ? forShell, withSwiftshader ? false
, buildProfiling ? false, buildInstrumented ? false, safeVulkanFFI ? false }:

let
  haskellPackages = import ../nix/haskell-packages.nix {
    inherit pkgs compiler hoogle buildProfiling buildInstrumented safeVulkanFFI;
  };
in if forShell then
  haskellPackages.shellFor ({
    packages = p: [ p.vulkan-examples ];
    buildInputs = with pkgs;
      [ vulkan-tools-lunarg vulkan-validation-layers shaderc ]
      ++ pkgs.lib.optional withSwiftshader vulkan-extension-layer
      ++ pkgs.lib.optional buildProfiling [
        haskellPackages.eventlog2html
        haskellPackages.hs-speedscope
        haskellPackages.opentelemetry-extra
        pkgs.tracy
        pkgs.gdb
        pkgs.linuxPackages.perf
      ];
    withHoogle = hoogle;
  } // pkgs.lib.optionalAttrs withSwiftshader {
    VK_ICD_FILENAMES =
      "${pkgs.swiftshader}/share/vulkan/icd.d/vk_swiftshader_icd.json";
    VK_INSTANCE_LAYERS = "VK_LAYER_KHRONOS_timeline_semaphore";
  })
else
  haskellPackages.vulkan-examples


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

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

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

  propagatedBuildInputs = [ protobuf hidapi requests ];

  buildInputs = [ ecdsa mnemonic ];

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

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

Move mnemonic dependency to propagatedBuildInputs

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

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

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

  propagatedBuildInputs = [ protobuf hidapi requests mnemonic ];

  buildInputs = [ ecdsa ];

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

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


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

  services.emacs.enable = true;

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

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

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

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

Add linux host dependency pavucontrol

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

  services.emacs.enable = true;

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

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

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

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


{ ... }:

{
  programs.jq.enable = true;
}

Add nix-diff to user environment

{ pkgs, ... }:

{
  programs.jq.enable = true;

  home.packages = with pkgs; [
    nix-diff
  ];
}


{ stdenv, fetchgit, asciidoc, libxslt }:

stdenv.mkDerivation rec {
  name    = "trace-cmd-${version}";
  version = "2.5.3";

  src = fetchgit {
    url    = "git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/trace-cmd.git";
    rev    = "refs/tags/trace-cmd-v${version}";
    sha256 = "32db3df07d0371c2b072029c6c86c4204be8cbbcb53840fa8c42dbf2e35c047b";
  };

  buildInputs = [ asciidoc libxslt ];

  configurePhase = "true";
  buildPhase     = "make prefix=$out all doc";
  installPhase   = "make prefix=$out install install_doc";

  meta = {
    description = "user-space tools for the Linux kernel ftrace subsystem";
    license     = stdenv.lib.licenses.gpl2;
    platforms   = stdenv.lib.platforms.linux;
    maintainers = [ stdenv.lib.maintainers.thoughtpolice ];
  };
}

Fix build by adding docbook_xsl dependency

{ stdenv, fetchgit, asciidoc, docbook_xsl, libxslt }:

stdenv.mkDerivation rec {
  name    = "trace-cmd-${version}";
  version = "2.5.3";

  src = fetchgit {
    url    = "git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/trace-cmd.git";
    rev    = "refs/tags/trace-cmd-v${version}";
    sha256 = "32db3df07d0371c2b072029c6c86c4204be8cbbcb53840fa8c42dbf2e35c047b";
  };

  buildInputs = [ asciidoc libxslt ];

  configurePhase = "true";
  buildPhase     = "make prefix=$out MANPAGE_DOCBOOK_XSL=${docbook_xsl}/xml/xsl/docbook/manpages/docbook.xsl all doc";
  installPhase   = "make prefix=$out install install_doc";

  meta = {
    description = "user-space tools for the Linux kernel ftrace subsystem";
    license     = stdenv.lib.licenses.gpl2;
    platforms   = stdenv.lib.platforms.linux;
    maintainers = [ stdenv.lib.maintainers.thoughtpolice ];
  };
}


{stdenv, fetchurl}:

stdenv.mkDerivation {
  name = "zip-3.0";

  src = fetchurl {
    url = ftp://ftp.info-zip.org/pub/infozip/src/zip30.tgz;
    sha256 = "0sb3h3067pzf3a7mlxn1hikpcjrsvycjcnj9hl9b1c3ykcgvps7h";
  };

  buildFlags="-f unix/Makefile generic";

  installFlags="-f unix/Makefile prefix=$out INSTALL=cp";

  meta = {
    homepage = http://www.info-zip.org;
  };
}

Make it actually install something

{stdenv, fetchurl}:

stdenv.mkDerivation {
  name = "zip-3.0";

  src = fetchurl {
    url = ftp://ftp.info-zip.org/pub/infozip/src/zip30.tgz;
    sha256 = "0sb3h3067pzf3a7mlxn1hikpcjrsvycjcnj9hl9b1c3ykcgvps7h";
  };

  buildFlags="-f unix/Makefile generic";

  installFlags="-f unix/Makefile prefix=$(out) INSTALL=cp";

  meta = {
    homepage = http://www.info-zip.org;
  };
}


{ lib, stdenv, fetchurl, pkg-config, glib, libxml2, flex, bison, vips, gtk2
, fftw, gsl, goffice, libgsf }:

stdenv.mkDerivation rec {
  pname = "nip2";
  version = "8.7.1";

  src = fetchurl {
    url = "https://github.com/libvips/nip2/releases/download/v${version}/nip2-${version}.tar.gz";
    sha256 = "0l7n427njif53npqn02gfjjly8y3khbrkzqxp10j5vp9h97psgiw";
  };

  buildInputs =
  [ pkg-config glib libxml2 flex bison vips
    gtk2 fftw gsl goffice libgsf
  ];

  meta = with lib; {
    homepage = "https://github.com/libvips/nip2";
    description = "Graphical user interface for VIPS image processing system";
    license = licenses.gpl2Plus;
    maintainers = with maintainers; [ kovirobi ];
    platforms = platforms.unix;
  };
}

Fix location of builtins by setting VIPSHOME

{ lib
, stdenv
, fetchurl
, pkg-config
, glib
, libxml2
, flex
, bison
, vips
, gtk2
, fftw
, gsl
, goffice
, libgsf
, makeWrapper
}:

stdenv.mkDerivation rec {
  pname = "nip2";
  version = "8.7.1";

  src = fetchurl {
    url = "https://github.com/libvips/nip2/releases/download/v${version}/nip2-${version}.tar.gz";
    sha256 = "0l7n427njif53npqn02gfjjly8y3khbrkzqxp10j5vp9h97psgiw";
  };

  buildInputs =
    [
      pkg-config
      glib
      libxml2
      flex
      bison
      vips
      gtk2
      fftw
      gsl
      goffice
      libgsf
      makeWrapper
    ];

  postFixup = ''
    wrapProgram $out/bin/nip2 --set VIPSHOME "$out"
  '';

  meta = with lib; {
    homepage = "https://github.com/libvips/nip2";
    description = "Graphical user interface for VIPS image processing system";
    license = licenses.gpl2Plus;
    maintainers = with maintainers; [ kovirobi ];
    platforms = platforms.unix;
  };
}


# From an end-user configuration file (`configuration'), build a NixOS
# configuration object (`config') from which we can retrieve option
# values.

{ configuration
, system ? builtins.currentSystem
, nixpkgs ? import ./from-env.nix "NIXPKGS" /etc/nixos/nixpkgs
, pkgs ? import nixpkgs {inherit system;}
}:

rec {
  inherit nixpkgs pkgs;

  configComponents = [
    configuration
    {
      require = import ../modules/module-list.nix;
      environment.checkConfigurationOptions = pkgs.lib.mkOption {
        default = true;
        example = false;
        description = ''
          Whether to check the validity of the entire configuration.
        '';
      };
    }
  ];

  config_ =
    pkgs.lib.fixOptionSets
      pkgs.lib.mergeOptionSets
      pkgs configComponents;

  optionDeclarations =
    pkgs.lib.fixOptionSetsFun
      pkgs.lib.filterOptionSets
      pkgs configComponents
      config_;

  # Optionally check wether all config values have corresponding
  # option declarations.
  config = pkgs.checker config_
    config_.environment.checkConfigurationOptions
    optionDeclarations config_;
}

Update function arguments to follow nixpkgs modification.

# From an end-user configuration file (`configuration'), build a NixOS
# configuration object (`config') from which we can retrieve option
# values.

{ configuration
, system ? builtins.currentSystem
, nixpkgs ? import ./from-env.nix "NIXPKGS" /etc/nixos/nixpkgs
, pkgs ? import nixpkgs {inherit system;}
}:

rec {
  inherit nixpkgs pkgs;

  configComponents = [
    configuration
    {
      require = import ../modules/module-list.nix;
      environment.checkConfigurationOptions = pkgs.lib.mkOption {
        default = true;
        example = false;
        description = ''
          Whether to check the validity of the entire configuration.
        '';
      };
    }
  ];

  config_ =
    pkgs.lib.fixOptionSets
      pkgs.lib.mergeOptionSets
      { inherit pkgs; } configComponents;

  optionDeclarations =
    pkgs.lib.fixOptionSetsFun
      pkgs.lib.filterOptionSets
      { inherit pkgs; } configComponents
      config_;

  # Optionally check wether all config values have corresponding
  # option declarations.
  config = pkgs.checker config_
    config_.environment.checkConfigurationOptions
    optionDeclarations config_;
}


{ stdenv, fetchFromGitHub, linuxHeaders }:

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

  src = fetchFromGitHub {
    owner = "kernelslacker";
    repo = "trinity";
    rev = "v${version}";
    sha256 = "1jwgsjjbngn2dsnkflyigy3ajd0szksl30dlaiy02jc6mqi3nr0p";
  };

  patchPhase = ''
    patchShebangs ./configure.sh
    patchShebangs ./scripts/
    substituteInPlace Makefile --replace '/usr/bin/wc' 'wc'
    substituteInPlace configure.sh --replace '/usr/include/linux' '${linuxHeaders}/include/linux'
  '';

  configurePhase = "./configure.sh";

  installPhase = "make DESTDIR=$out install";

  meta = with stdenv.lib; {
    description = "A Linux System call fuzz tester";
    homepage = http://codemonkey.org.uk/projects/trinity/;
    license = licenses.gpl2;
    maintainers = [ maintainers.dezgeg ];
    platforms = platforms.linux;
  };
}

Apply upstream commit as a patch to fix build

{ stdenv, fetchurl, fetchFromGitHub, linuxHeaders }:

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

  src = fetchFromGitHub {
    owner = "kernelslacker";
    repo = "trinity";
    rev = "v${version}";
    sha256 = "1jwgsjjbngn2dsnkflyigy3ajd0szksl30dlaiy02jc6mqi3nr0p";
  };

  patches = stdenv.lib.singleton (fetchurl {
    url = "https://github.com/kernelslacker/trinity/commit/b0e66a2d084ffc210bc1fc247efb4d177e9f7e3d.patch";
    sha256 = "0468fdzbsj3n3k43qm8hf56pa020qn57ripcykv9jfwp215lf0an";
  });

  postPatch = ''
    patchShebangs ./configure.sh
    patchShebangs ./scripts/
    substituteInPlace Makefile --replace '/usr/bin/wc' 'wc'
    substituteInPlace configure.sh --replace '/usr/include/linux' '${linuxHeaders}/include/linux'
  '';

  configurePhase = "./configure.sh";

  enableParallelBuilding = true;

  installPhase = "make DESTDIR=$out install";

  meta = with stdenv.lib; {
    description = "A Linux System call fuzz tester";
    homepage = http://codemonkey.org.uk/projects/trinity/;
    license = licenses.gpl2;
    maintainers = [ maintainers.dezgeg ];
    platforms = platforms.linux;
  };
}


{ stdenv, fetchFromGitHub, rustPlatform }:

rustPlatform.buildRustPackage rec {
  name = "xsv-${version}";
  version = "0.13.0";

  src = fetchFromGitHub {
    owner = "BurntSushi";
    repo = "xsv";
    rev = version;
    sha256 = "17v1nw36mrarrd5yv4xd3mpc1d7lvhd5786mqkzyyraf78pjg045";
  };

  cargoSha256 = "1qk5wkjm3d4dz5fldlq7rjlm602v0l04hxrbar2j6vhcz9w2r4n6";

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

Add darwin.Security as dependency on MacOS

{ stdenv, fetchFromGitHub, rustPlatform, pkgs }:

rustPlatform.buildRustPackage rec {
  name = "xsv-${version}";
  version = "0.13.0";

  src = fetchFromGitHub {
    owner = "BurntSushi";
    repo = "xsv";
    rev = version;
    sha256 = "17v1nw36mrarrd5yv4xd3mpc1d7lvhd5786mqkzyyraf78pjg045";
  };

  cargoSha256 = "1qk5wkjm3d4dz5fldlq7rjlm602v0l04hxrbar2j6vhcz9w2r4n6";

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

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


{ config, pkgs, ... }:

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

  environment.systemPackages = with pkgs;
    [ # Shells
      zsh

      # Editors
      vim
      # 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
    ];

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

Add pp-aterm for inspecting drvs

{ config, pkgs, ... }:

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

  environment.systemPackages = with pkgs;
    [ # Shells
      zsh

      # Editors
      vim
      # 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
    ];

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


{ config, pkgs, ... }:
{
  # Use the systemd-boot EFI boot loader.
  boot.loader.systemd-boot.enable = true;
  boot.loader.efi.canTouchEfiVariables = true;
  boot.blacklistedKernelModules = [
    "hid_sensor_hub"
  ];

  # becuase we are dual booting
  time.hardwareClockInLocalTime = true;
  services.fwupd.enable = true;

  networking.hostName = "dino"; # Define your hostname.
  networking.wireless.enable = true;
  system.stateVersion = "22.05";
}

Revert "Revert "feat(dino): enable hidpi""

{ config, pkgs, ... }:
{
  # Use the systemd-boot EFI boot loader.
  boot.loader.systemd-boot.enable = true;
  boot.loader.efi.canTouchEfiVariables = true;
  boot.blacklistedKernelModules = [
    "hid_sensor_hub"
  ];

  # becuase we are dual booting
  time.hardwareClockInLocalTime = true;
  services.fwupd.enable = true;
  hardware.video.hidpi.enable = true;

  networking.hostName = "dino"; # Define your hostname.
  networking.wireless.enable = true;
  system.stateVersion = "22.05";
}


{ lib
, buildPythonPackage
, fetchFromGitHub
, mock
, pytest
, unittest2
, six
}:

buildPythonPackage rec {
  pname = "ntlm-auth";
  version = "1.0.4";
  name = "${pname}-${version}";

  src = fetchFromGitHub {
    owner = "jborean93";
    repo = "ntlm-auth";
    rev = "v${version}";
    sha256 = "3d411413f1309fcd443095d57ab169b637e5b57ce701ac7ae8dbf572cb3533c0";
  };

  checkInputs = [ mock pytest unittest2 ];
  propagatedBuildInputs = [ six ];

  # Functional tests require networking
  checkPhase = ''
    py.test --ignore=tests/functional/test_iis.py
  '';

  meta = with lib; {
    description = "Calculates NTLM Authentication codes";
    homepage = https://github.com/jborean93/ntlm-auth;
    license = licenses.lgpl3;
    maintainers = with maintainers; [ elasticdog ];
    platforms = platforms.all;
  };
}

Revert "python.pkgs.ntlm-auth: 1.0.3 -> 1.0.4"

{ lib
, buildPythonPackage
, fetchFromGitHub
, mock
, pytest
, unittest2
, six
}:

buildPythonPackage rec {
  pname = "ntlm-auth";
  version = "1.0.3";
  name = "${pname}-${version}";

  src = fetchFromGitHub {
    owner = "jborean93";
    repo = "ntlm-auth";
    rev = "v${version}";
    sha256 = "09f2g4ivfi9lh1kr30hlg0q4n2imnvmd79w83gza11q9nmhhiwpz";
  };

  checkInputs = [ mock pytest unittest2 ];
  propagatedBuildInputs = [ six ];

  # Functional tests require networking
  checkPhase = ''
    py.test --ignore=tests/functional/test_iis.py
  '';

  meta = with lib; {
    description = "Calculates NTLM Authentication codes";
    homepage = https://github.com/jborean93/ntlm-auth;
    license = licenses.lgpl3;
    maintainers = with maintainers; [ elasticdog ];
    platforms = platforms.all;
  };
}


{stdenv, fetchurl, zlib, ocaml, findlib, ncurses}:

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

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

  src = fetchurl {
    url = "http://forge.ocamlcore.org/frs/download.php/1166/" +
          "cryptokit-${version}.tar.gz";
    sha256 = "56a8c0339c47ca3cf43c8881d5b519d3bff68bc8a53267e9c5c9cbc9239600ca";
  };

  buildInputs = [zlib ocaml findlib ncurses];

  buildFlags = "setup.data build";

  preBuild = "mkdir -p $out/lib/ocaml/${ocaml_version}/site-lib/cryptokit";

  meta = {
    homepage = "http://pauillac.inria.fr/~xleroy/software.html";
    description = "A library of cryptographic primitives for OCaml";
    platforms = ocaml.meta.platforms;
    maintainers = [
      stdenv.lib.maintainers.z77z
    ];
  };
}

Update cryptokit to version 1.9

{stdenv, fetchurl, zlib, ocaml, findlib, ncurses}:

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

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

  src = fetchurl {
    url = http://forge.ocamlcore.org/frs/download.php/1166/cryptokit-1.9.tar.gz;
    sha256 = "1jh0jqiwkjy9qplnfcm5r25zdgyk36sxb0c87ks3rjj7khrw1a2n";
  };

  buildInputs = [zlib ocaml findlib ncurses];

  buildFlags = "setup.data build";

  preBuild = "mkdir -p $out/lib/ocaml/${ocaml_version}/site-lib/cryptokit";

  meta = {
    homepage = "http://pauillac.inria.fr/~xleroy/software.html";
    description = "A library of cryptographic primitives for OCaml";
    platforms = ocaml.meta.platforms;
    maintainers = [
      stdenv.lib.maintainers.z77z
    ];
  };
}


# This is a nix-shell for use with the nix package manager.
# If you have nix installed, you may simply run `nix-shell`
# in this repo, and have all dependencies ready in the new shell.

{pkgs ? import (builtins.fetchTarball {
  # Descriptive name to make the store path easier to identify
  name = "nixos-2021-05";
  # Commit hash
  url = "https://github.com/NixOS/nixpkgs/archive/refs/tags/21.05.tar.gz";
  # Hash obtained using `nix-prefetch-url --unpack <url>`
  sha256 = "1ckzhh24mgz6jd1xhfgx0i9mijk6xjqxwsshnvq789xsavrmsc36";
}) {}}:

pkgs.mkShell {
  buildInputs = with pkgs;
    [
      cmake
      swig
      tcl
      jre8
      antlr4
      pkg-config
      libuuid
    ];

}

Add more specific dependencies for the nix build.

# This is a nix-shell for use with the nix package manager.
# If you have nix installed, you may simply run `nix-shell`
# in this repo, and have all dependencies ready in the new shell.

{pkgs ? import (builtins.fetchTarball {
  # Descriptive name to make the store path easier to identify
  name = "nixos-2021-05";
  # Commit hash
  url = "https://github.com/NixOS/nixpkgs/archive/refs/tags/21.05.tar.gz";
  # Hash obtained using `nix-prefetch-url --unpack <url>`
  sha256 = "1ckzhh24mgz6jd1xhfgx0i9mijk6xjqxwsshnvq789xsavrmsc36";
}) {}}:

pkgs.mkShell {
  buildInputs = with pkgs;
    [
      cmake
      swig
      tcl
      jre8
      antlr4
      pkg-config
      libuuid
      diffutils
      time
      gperftools
      zlib
    ];

}


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

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

  src = fetchurl {
    url = "mirror://alsa/firmware/${pname}-${version}.tar.bz2";
    sha256 = "1fymdjrsbndws3gy4ypm7id31261k65bh2pzyrz29z5w11ynsyxn";
  };

  nativeBuildInputs = [ autoreconfHook buildPackages.stdenv.cc ];

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

  dontStrip = true;

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

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

Revert "alsa-firmware: 1.2.1 -> 1.2.4"

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

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

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

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

  nativeBuildInputs = [ autoreconfHook buildPackages.stdenv.cc ];

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

  dontStrip = true;

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

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


{stdenv, fetchurl, yasm, enable10bit ? false}:

stdenv.mkDerivation rec {
  version = "20141218-2245";
  name = "x264-${version}";

  src = fetchurl {
    url = "http://download.videolan.org/x264/snapshots/x264-snapshot-${version}-stable.tar.bz2";
    sha256 = "1gp1f0382vh2hmgc23ldqyywcfljg8lsgl2849ymr14r6gxfh69m";
  };

  patchPhase = ''
    sed -i s,/bin/bash,${stdenv.shell}, configure version.sh
  '';

  outputs = [ "out" "lib" ]; # leaving 52 kB of headers

  configureFlags = [ "--enable-shared" ]
    ++ stdenv.lib.optional (!stdenv.isi686) "--enable-pic"
    ++ stdenv.lib.optional (enable10bit) "--bit-depth=10";

  buildInputs = [ yasm ];

  meta = with stdenv.lib; {
    description = "library for encoding H264/AVC video streams";
    homepage    = http://www.videolan.org/developers/x264.html;
    license     = licenses.gpl2;
    platforms   = platforms.unix;
    maintainers = [ maintainers.spwhitt ];
  };
}

Update x264 to a recent snapshot (1,5 years update)

{stdenv, fetchurl, yasm, enable10bit ? false}:

stdenv.mkDerivation rec {
  version = "20160615-2245";
  name = "x264-${version}";

  src = fetchurl {
    url = "http://download.videolan.org/x264/snapshots/x264-snapshot-${version}-stable.tar.bz2";
    sha256 = "0w5l77gm8bsmafzimzyc5s27kcw79r6nai3bpccqy0spyxhjsdc2";
  };

  patchPhase = ''
    sed -i s,/bin/bash,${stdenv.shell}, configure version.sh
  '';

  outputs = [ "out" "lib" ]; # leaving 52 kB of headers

  configureFlags = [ "--enable-shared" ]
    ++ stdenv.lib.optional (!stdenv.isi686) "--enable-pic"
    ++ stdenv.lib.optional (enable10bit) "--bit-depth=10";

  buildInputs = [ yasm ];

  meta = with stdenv.lib; {
    description = "library for encoding H264/AVC video streams";
    homepage    = http://www.videolan.org/developers/x264.html;
    license     = licenses.gpl2;
    platforms   = platforms.unix;
    maintainers = [ maintainers.spwhitt ];
  };
}


{stdenv, fetchurl, gmp, static ? false}:

let
  version = "0.06";
  staticFlags = if static then " --enable-static --disable-shared" else "";
in

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

  src = fetchurl {
    url = "http://www.kotnet.org/~skimo/isl/isl-${version}.tar.bz2";
    sha256 = "0w1i1m94w0jkmm0bzlp08c4r97j7yp0d7crxf28524b9mgbg0mwk";
  };

  buildInputs = [ gmp ];

  dontDisableStatic = if static then true else false;
  configureFlags = "--with-gmp-prefix=${gmp}" + staticFlags;

  meta = {
    homepage = http://www.kotnet.org/~skimo/isl/;
    license = "LGPLv2.1";
    description = "A library for manipulating sets and relations of integer points bounded by linear constraints.";
    maintainers = [ stdenv.lib.maintainers.shlevy ];
  };
}

Use correct gmp for cross-build

{stdenv, fetchurl, gmp, static ? false}:

let
  version = "0.06";
  staticFlags = if static then " --enable-static --disable-shared" else "";
in

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

  src = fetchurl {
    url = "http://www.kotnet.org/~skimo/isl/isl-${version}.tar.bz2";
    sha256 = "0w1i1m94w0jkmm0bzlp08c4r97j7yp0d7crxf28524b9mgbg0mwk";
  };

  buildInputs = [ gmp ];

  dontDisableStatic = if static then true else false;
  configureFlags = "--with-gmp-prefix=${gmp}" + staticFlags;
  crossAttrs = {
    configureFlags = configureFlags + " --with-gmp-prefix=${gmp.hostDrv} ";
  };

  meta = {
    homepage = http://www.kotnet.org/~skimo/isl/;
    license = "LGPLv2.1";
    description = "A library for manipulating sets and relations of integer points bounded by linear constraints.";
    maintainers = [ stdenv.lib.maintainers.shlevy ];
  };
}


{ stdenv
, fetchTritonPatch
, fetchurl
}:

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

  src = fetchurl {
    url = "https://mp4v2.googlecode.com/files/${name}.tar.bz2";
    multihash = "QmUqS6HpKpUxXm7Pun24MAewxdLT6RGjt4siDvzJTf7nbV";
    sha256 = "0319b9a60b667cf10ee0ec7505eb7bdc0a2e21ca7a93db96ec5bd758e3428338";
  };

  meta = with stdenv.lib; {
    description = "Functions for accessing ISO-IEC:14496-1:2001 MPEG-4 standard";
    homepage = http://code.google.com/p/mp4v2;
    license = licenses.mpl11;
    maintainers = with maintainers; [
      codyopel
    ];
    platforms = with platforms;
      x86_64-linux;
  };
}

Remove unused googlecode url that only 404's

{ stdenv
, fetchTritonPatch
, fetchurl
}:

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

  src = fetchurl {
    name = "${name}.tar.bz2";
    multihash = "QmUqS6HpKpUxXm7Pun24MAewxdLT6RGjt4siDvzJTf7nbV";
    sha256 = "0319b9a60b667cf10ee0ec7505eb7bdc0a2e21ca7a93db96ec5bd758e3428338";
  };

  meta = with stdenv.lib; {
    description = "Functions for accessing ISO-IEC:14496-1:2001 MPEG-4 standard";
    homepage = http://code.google.com/p/mp4v2;
    license = licenses.mpl11;
    maintainers = with maintainers; [
      codyopel
    ];
    platforms = with platforms;
      x86_64-linux;
  };
}


{ lib, buildPackages, fetchFromGitHub, fetchpatch, perl, buildLinux, ... } @ args:

buildLinux (args // {
  version = "5.9.0-2020.11.20";
  modDirVersion = "5.9.0";

  src = fetchFromGitHub {
    owner = "koverstreet";
    repo = "bcachefs";
    rev = "6a505b63ed3003faf5000f19fd08bbd477d93fbc";
    sha256 = "1rf34gzv9npafp1c3i6lymk3b0gnqp4rb0wl33pw6yrpgnsry3cc";
  };

  extraConfig = "BCACHEFS_FS m";

  extraMeta = {
    branch = "master";
    hydraPlatforms = []; # Should the testing kernels ever be built on Hydra?
    maintainers = with lib.maintainers; [ davidak chiiruno ];
    platforms = [ "x86_64-linux" ];
  };

} // (args.argsOverride or {}))

Add comment that commit does not exist on any branch on target repository

{ lib, buildPackages, fetchFromGitHub, fetchpatch, perl, buildLinux, ... } @ args:

buildLinux (args // {
  version = "5.9.0-2020.11.20";
  modDirVersion = "5.9.0";

  src = fetchFromGitHub {
    owner = "koverstreet";
    repo = "bcachefs";
    # commit does not exist on any branch on the target repository
    rev = "6a505b63ed3003faf5000f19fd08bbd477d93fbc";
    sha256 = "1rf34gzv9npafp1c3i6lymk3b0gnqp4rb0wl33pw6yrpgnsry3cc";
  };

  extraConfig = "BCACHEFS_FS m";

  extraMeta = {
    branch = "master";
    hydraPlatforms = []; # Should the testing kernels ever be built on Hydra?
    maintainers = with lib.maintainers; [ davidak chiiruno ];
    platforms = [ "x86_64-linux" ];
  };

} // (args.argsOverride or {}))


{ cabal, baseCompat, hspec, httpConduit, httpKit, httpTypes
, network, QuickCheck, warp
}:

cabal.mkDerivation (self: {
  pname = "reserve";
  version = "0.0.0";
  sha256 = "06rj1dh8lsfbmfkslyhqc031abrz2qw780i8w2c5pc146938pdi3";
  isLibrary = false;
  isExecutable = true;
  buildDepends = [ baseCompat httpKit httpTypes network ];
  testDepends = [
    baseCompat hspec httpConduit httpKit httpTypes network QuickCheck
    warp
  ];
  meta = {
    description = "Reserve reloads web applications";
    license = self.stdenv.lib.licenses.mit;
    platforms = self.ghc.meta.platforms;
  };
})

Update haskell package reserve to 0.1.0

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

{ cabal, baseCompat, hspec, httpConduit, httpKit, httpTypes
, network, QuickCheck, warp
}:

cabal.mkDerivation (self: {
  pname = "reserve";
  version = "0.1.0";
  sha256 = "09b570l6hyn0wfd4nb9xpqrpdb97gbaxnbjlz25y6s0pfg5s1yzp";
  isLibrary = false;
  isExecutable = true;
  buildDepends = [ baseCompat httpKit httpTypes network ];
  testDepends = [
    baseCompat hspec httpConduit httpKit httpTypes network QuickCheck
    warp
  ];
  meta = {
    description = "Reserve reloads web applications";
    license = self.stdenv.lib.licenses.mit;
    platforms = self.ghc.meta.platforms;
  };
})


{ stdenv, fetchurl, python, wrapPython }:

stdenv.mkDerivation rec {
  name = "python-setuptools-" + version;

  version = "0.6c11";

  src = fetchurl {
    url = "http://pypi.python.org/packages/source/s/setuptools/${name}.tar.gz";
    sha256 = "1lx1hwxkhipyh206bgl90ddnfcnb68bzcvyawczbf833fadyl3v3";
  };

  buildInputs = [ python wrapPython ];

  buildPhase = "python setup.py build --build-base $out";

  installPhase =
    ''
      dst=$out/lib/${python.libPrefix}/site-packages
      mkdir -p $dst
      PYTHONPATH=$dst:$PYTHONPATH
      python setup.py install --prefix=$out
      wrapPythonPrograms
    '';

  doCheck = false; # doesn't work with Python 2.7

  checkPhase = "python setup.py test";

  meta = {
    description = "Utilities to facilitate the installation of Python packages";
    homepage = http://pypi.python.org/pypi/setuptools;
    licenses = [ "PSF" "ZPL" ];
  };
}

Fix download link (the old one was returning 404)

{ stdenv, fetchurl, python, wrapPython }:

stdenv.mkDerivation rec {
  shortName = "setuptools-${version}";
  name = "python-${shortName}";

  version = "0.6c11";

  src = fetchurl {
    url = "http://pypi.python.org/packages/source/s/setuptools/${shortName}.tar.gz";
    sha256 = "1lx1hwxkhipyh206bgl90ddnfcnb68bzcvyawczbf833fadyl3v3";
  };

  buildInputs = [ python wrapPython ];

  buildPhase = "python setup.py build --build-base $out";

  installPhase =
    ''
      dst=$out/lib/${python.libPrefix}/site-packages
      mkdir -p $dst
      PYTHONPATH=$dst:$PYTHONPATH
      python setup.py install --prefix=$out
      wrapPythonPrograms
    '';

  doCheck = false; # doesn't work with Python 2.7

  checkPhase = "python setup.py test";

  meta = {
    description = "Utilities to facilitate the installation of Python packages";
    homepage = http://pypi.python.org/pypi/setuptools;
    licenses = [ "PSF" "ZPL" ];
  };
}


{ stdenv, symlinkJoin, pidgin, makeWrapper, plugins }:

let
extraArgs = map (x: x.wrapArgs or "") plugins;
in symlinkJoin {
  name = "pidgin-with-plugins-${pidgin.version}";

  paths = [ pidgin ] ++ plugins;

  buildInputs = [ makeWrapper ];

  postBuild = ''
    wrapProgram $out/bin/pidgin \
      --suffix-each PURPLE_PLUGIN_PATH ':' "$out/lib/purple-${pidgin.majorVersion} $out/lib/pidgin" \
      ${toString extraArgs}
  '';
}

Add plugin support for Finch, the CLI version of Pidgin.

{ stdenv, symlinkJoin, pidgin, makeWrapper, plugins }:

let
extraArgs = map (x: x.wrapArgs or "") plugins;
in symlinkJoin {
  name = "pidgin-with-plugins-${pidgin.version}";

  paths = [ pidgin ] ++ plugins;

  buildInputs = [ makeWrapper ];

  postBuild = ''
    wrapProgram $out/bin/pidgin \
      --suffix-each PURPLE_PLUGIN_PATH ':' "$out/lib/purple-${pidgin.majorVersion} $out/lib/pidgin" \
      ${toString extraArgs}
    wrapProgram $out/bin/finch \
      --suffix-each PURPLE_PLUGIN_PATH ':' "$out/lib/purple-${pidgin.majorVersion}" \
      ${toString extraArgs}
  '';
}