Add expression to create an openjdk bootstrap capable of building the full openjdk

{ runCommand, openjdk }:

let arch = if openjdk.system == "x86_64-linux" then "amd64" else "i386"; in

runCommand "${openjdk.name}-bootstrap" {} ''
  mkdir -p $out/bin
  mkdir -p $out/lib
  mkdir -p $out/jre/lib/{security,ext,${arch}/{jli,server,headless}}
  cp ${openjdk}/bin/{idlj,ja{va{,c,p,h},r},rmic} $out/bin
  cp ${openjdk}/lib/tools.jar $out/lib
  cp ${openjdk}/jre/lib/{meta-index,{charsets,jce,jsse,rt,resources}.jar,currency.data} $out/jre/lib
  cp ${openjdk}/jre/lib/security/java.security $out/jre/lib/security
  cp ${openjdk}/jre/lib/ext/{meta-index,sunjce_provider.jar} $out/jre/lib/ext
  cp ${openjdk}/jre/lib/${arch}/{jvm.cfg,lib{awt,java,verify,zip,nio,net}.so} $out/jre/lib/${arch}
  cp ${openjdk}/jre/lib/${arch}/jli/libjli.so $out/jre/lib/${arch}/jli
  cp ${openjdk}/jre/lib/${arch}/server/libjvm.so $out/jre/lib/${arch}/server
  cp ${openjdk}/jre/lib/${arch}/headless/libmawt.so $out/jre/lib/${arch}/headless
  cp -a ${openjdk}/include $out
''


Add a regression test for correct path antiquotation behavior

# This must fail to evaluate, since ./fnord doesn't exist.  If it did
# exist, it would produce "/nix/store/<hash>-fnord/xyzzy" (with an
# appropriate context).
"${./fnord}/xyzzy"


Add simple helper for testing AppImage exec on NixOS

{ appimagefile, nixpkgs' ? <nixpkgs> }:

# nix build -f test-appimage.nix --arg appimagefile ./VLC*AppImage

with import nixpkgs' {};

runCommand "patchelf" {} ''
  cp ${appimagefile} $out
  chmod +w $out
  patchelf \
    --set-interpreter ${stdenv.cc.bintools.dynamicLinker} \
    --set-rpath ${stdenv.glibc.out}/lib:${fuse}/lib:${zlib}/lib:${glib}/lib \
    $out
''


Add modified hardware configuration for 2018 latptop

# Do not modify this file!  It was generated by ‘nixos-generate-config’
# and may be overwritten by future invocations.  Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, ... }:

{
  imports =
    [ <nixpkgs/nixos/modules/installer/scan/not-detected.nix>
    ];

  boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "uas" "usb_storage" "sd_mod" ];
  boot.kernelModules = [ "kvm-intel" ];
  boot.extraModulePackages = [ ];

  boot.initrd.luks.devices = {
    "zfs-luksroot" = {
      device = "/dev/disk/by-partuuid/13608ae1-f65b-449b-8e6e-67e2dc7b2ffd";
      preLVM = true;
      allowDiscards = true;
    };
  };

  fileSystems."/" = {
    device = "rpool/root";
    fsType = "zfs";
  };

  fileSystems."/home" = {
    device = "rpool/home";
    fsType = "zfs";
  };

  fileSystems."/nix" = {
    device = "rpool/nix";
    fsType = "zfs";
  };

  fileSystems."/boot" = {
    device = "/dev/disk/by-partuuid/bbeafaa9-5c3f-4fc5-a2e5-6c091432d97d";
    fsType = "vfat";
  };

  swapDevices = [ ];

  nix.maxJobs = lib.mkDefault 8;
  powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
}


Add file with Azure image locations, similar to ec2-amis.nix. Will be used by nixops.

let self = {
  "16.09" = "https://nixos.blob.core.windows.net/images/nixos-image-16.09.1694.019dcc3-x86_64-linux.vhd";

  latest = self."16.09";
}; in self


{ stdenv, fetchgit, pkgs }:

stdenv.mkDerivation rec {
  version = "0.8.5";
  name = "rdkafka";

  # Maintenance repo for libtar (Arch Linux uses this)
  src = fetchgit {
    url = "https://github.com/edenhill/librdkafka.git";
    rev = "refs/tags/${version}";
    sha256 = "05a83hmpz1xmnln0wa7n11ijn08zxijdvpdswyymxbdlg69w31y1";
  };

  patchPhase = "patchShebangs .";

  buildInputs = [ pkgs.zlib pkgs.perl ];

  meta = with stdenv.lib; {
    description = "librdkafka - Apache Kafka C/C++ client library";
    homepage = "https://github.com/edenhill/librdkafka";
    license = licenses.bsd2;
    platforms = platforms.linux;
    maintainers = [ maintainers.boothead ];
  };
}


Add Nylas mail module. Still needs keyring configuration

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

with lib;

let
  cfg = config.services.nylas-mail;
  defaultUser = "nylas-mail";
in {
  ###### interface
  options = {
    services.nylas-mail = {

      enable = mkEnableOption ''
        nylas-mail - Open-source mail client built on the modern web with Electron, React, and Flux
      '';

      gnome3-keyring = mkOption {
        type = types.bool;
        default = true;
        description = "Enable gnome3 keyring for nylas-mail.";
      };

      package = mkOption {
        type = types.package;
        default = pkgs.nylas-mail;
        defaultText = "pkgs.nylas-mail";
        example = literalExample "pkgs.nylas-mail";
        description = ''
          nylas-mail package to use.
        '';
      };
    };
  };

  ###### implementation

  config = mkIf cfg.enable {

  };
}


{ stdenv, fetchFromGitHub, cmake, pkgconfig
, poppler, xlibs, pcre, python, glib, fontforge, cairo, pango, openjdk8
}:

stdenv.mkDerivation rec {
  name = "pdf2htmlEX-0.14.6";

  src = fetchFromGitHub {
    repo   = "pdf2htmlEX";
    owner  = "coolwanglu";
    rev    = "v0.14.6";
    sha256 = "1nh0ab8f11fsyi4ldknlkmdzcfvm1dfh8b9bmprjgq6q0vjj7f78";
  };

  patches = [ ./add-glib-cmake.patch ];

  cmakeFlags = [ "-DENABLE_SVG=ON" ];

  enableParallelBuilding = true;

  nativeBuildInputs = [
    cmake
    pkgconfig
  ];

  buildInputs = [
    xlibs.libpthreadstubs
    xlibs.libXdmcp
    pcre
    python
    glib
    cairo
    pango
    (poppler.override { withData = true; })
    fontforge
    openjdk8
  ];

  meta = with stdenv.lib; {
    description = "Render PDF files to beautiful HTML";
    homepage    = "https://github.com/coolwanglu/pdf2htmlEX";
    license     = licenses.gpl3Plus;
    maintainers = [ maintainers.taktoa ];
    platforms   = with platforms; linux;
  };
}


Add script to compile the program more easily on NixOS

# This script is used for building the program on NixOS with the proper dependencies.
# To use, simply run nix-shell in this directory and run "cargo build" as you normally would.

with import <nixpkgs> {};

stdenv.mkDerivation {
    name = "anup";
    buildInputs = [ pkgconfig openssl zlib ];
}


with builtins;
with import ./utils.nix;

options:

concatStrings (map
  (name:
    let option = options.${name}; in
    "  - `${name}`  \n\n"
    + concatStrings (map (s: "    ${s}\n") (splitLines option.description)) + "\n\n"
    + "    **Default:** " + (
      if option.value == "" || option.value == []
      then "*empty*"
      else if isBool option.value
      then (if option.value then "`true`" else "`false`")
      else "`" + toString option.value + "`") + "\n\n"
    + (if option.aliases != []
       then "    **Deprecated alias:** " + (concatStringsSep ", " (map (s: "`${s}`") option.aliases)) + "\n\n"
       else "")
    )
  (attrNames options))

Update document generation for empty json object values.

with builtins;
with import ./utils.nix;

options:

concatStrings (map
  (name:
    let option = options.${name}; in
    "  - `${name}`  \n\n"
    + concatStrings (map (s: "    ${s}\n") (splitLines option.description)) + "\n\n"
    + "    **Default:** " + (
      if option.value == "" || option.value == []
      then "*empty*"
      else if isBool option.value
      then (if option.value then "`true`" else "`false`")
      else
        # n.b. a StringMap value type is specified as a string, but
        # this shows the value type.  The empty stringmap is "null" in
        # JSON, but that converts to "{ }" here.
        (if isAttrs option.value then "`\"\"`"
         else "`" + toString option.value + "`")) + "\n\n"
    + (if option.aliases != []
       then "    **Deprecated alias:** " + (concatStringsSep ", " (map (s: "`${s}`") option.aliases)) + "\n\n"
       else "")
    )
  (attrNames options))


{ stdenv, zookeeper, bash }:

stdenv.mkDerivation rec {
   name = "zookeeper_mt";

   src = zookeeper.src;

   setSourceRoot = "export sourceRoot=${zookeeper.name}/src/c";

   buildInputs = [ zookeeper bash ];

   meta = with stdenv.lib; {
   	homepage = "http://zookeeper.apache.org";
   	description = "Apache Zookeeper";
   	license = licenses.asl20;
   	maintainers = [ maintainers.boothead ];
   	platforms = platforms.unix;
   };
}


{ stdenv, fetchurl, sbcl, libX11, libXpm, libICE, libSM, libXt, libXau, libXdmcp }:

stdenv.mkDerivation rec {
  name = "fricas-1.2.2";

  src = fetchurl {
    url    = "http://sourceforge.net/projects/fricas/files/fricas/1.2.2/${name}-full.tar.bz2";
    sha256 = "87db64a1fd4211f3b776793acea931b4271d2e7a28396414c7d7397d833defe1";
  };

  buildInputs = [ sbcl libX11 libXpm libICE libSM libXt libXau libXdmcp ];

  dontStrip = true;

  meta = {
    description = "Fricas CAS";
    homepage    = http://fricas.sourceforge.net/;
    maintainers = stdenv.lib.maintainers.sprock;
    platforms   = stdenv.lib.platforms.linux;
    license     = stdenv.lib.license.bsd3;
  };
}


let pkgs = import <nixpkgs> {};
in

{ stdenv         ? pkgs.stdenv
, buildGoPackage ? pkgs.buildGoPackage
, fetchgit       ? pkgs.fetchgit
, libsodium      ? pkgs.libsodium
, zeromq         ? pkgs.zeromq
, czmq           ? pkgs.czmq
, glide          ? pkgs.glide
, git            ? pkgs.git }:

buildGoPackage rec {
  name = "skygear";

  goPackagePath = "github.com/skygeario/skygear-server";

  # If you are doing development and want to build the current source:
  src = ./.;
  allowGoReference = true;

  # If you are not doing development, just want to build a commit:
  # Remember to update the hash / commit
  # src = fetchgit {
  #   rev = "commit hash here";
  #   url = "git@github.com:SkygearIO/skygear-server.git";
  #   sha256 = "hash here";
  # };
  buildInputs = [ libsodium zeromq czmq git glide ];

  preBuild = ''
    pushd "go/src/${goPackagePath}"
    make vendor
    popd
  '';

  # Need this for glide to download dependencies
  SSL_CERT_FILE="${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt";

  meta = {
    homepage = "https://skygear.io";
    license = stdenv.lib.licenses.asl20;
  };
}


{
  nixpkgs ? <nixpkgs>,
  pkgs ? import nixpkgs {}
}:

pkgs.stdenv.mkDerivation {
  name = "pprintpp";
  src = ./.;
  nativeBuildInputs = [ pkgs.cmake ];
}


Add module for generating nixos-multi-spawn configurations

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

with lib;
with pkgs;
with builtins;

let

  cfg = config.nixos-multi-spawn;

  machineOpts = { name, config, ... }: {
    options = {
      environment = mkOption {
        type = with types; attrsOf str;
        default = {};
      };
      inheritEnvVars = mkOption {
        type = with types; listOf str;
        default = [];
      };
      nixosSystem = mkOption {
        type = types.package;
      };
    };
  };

in {
  imports = [
    ../resources/nixos-hosts.nix
  ];

  options = {
    nixos-multi-spawn = {

      initScript = mkOption {
        type = types.lines;
      };

      tailFiles = mkOption {
        type = with types; listOf str;
        default = [];
      };

      machines = mkOption {
        type = with types; attrsOf (submodule machineOpts);
        default = {};
      };

      configFile = mkOption {
        type = types.package;
      };

    };
  };

  config = {

    nixos-multi-spawn = {
      initScript = ''
        test -n "$IP" && \
          ${iproute}/bin/ip addr add $IP dev host0 && \
          ${iproute}/bin/ip link set dev host0 up
      '';

      machines = mapAttrs (name: host: {
        nixosSystem = host.nixos.out.system;
      }) config.resources.nixos.hosts;

      configFile = writeText "nms.json" (toJSON {
        inherit (cfg) tailFiles machines;
        initBinary = writeScript "init" ''
          #!${stdenv.shell}
          ${cfg.initScript}
          exec "$@"
        '';
      });
    };

  };

}


Revert "Remove the nixos module for NetworkManager dynamic dns (it's been merged to nixpkgs)"

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

with lib;

let

  cfg = config.networking.networkmanager.dynamicHosts;

  enable = config.networking.networkmanager.enable && cfg.enable &&
    cfg.hostsDirs != {};

in {
  options = {
    networking.networkmanager.dynamicHosts = {
      enable = mkOption {
        type = types.bool;
        default = false;
      };
      hostsDirs = mkOption {
        type = with types; attrsOf (submodule {
          options = {
            user = mkOption {
              type = types.str;
              default = "root";
            };
            group = mkOption {
              type = types.str;
              default = "root";
            };
          };
        });
        default = {};
      };
    };
  };

  config = mkIf enable {

    networking.networkmanager.useDnsmasq = true;

    systemd.services.nm-setup-hostsdirs = {
      wantedBy = [ "network-manager.service" ];
      before = [ "network-manager.service" ];
      partOf = [ "network-manager.service" ];
      script = concatStrings (mapAttrsToList (n: d: ''
        mkdir -p "/run/NetworkManager/hostsdirs/${n}"
        chown "${d.user}:${d.group}" "/run/NetworkManager/hostsdirs/${n}"
        chmod 0775 "/run/NetworkManager/hostsdirs/${n}"
      '') cfg.hostsDirs);
      serviceConfig = {
        Type = "oneshot";
        RemainAfterExist = true;
      };
    };

    environment.etc = {
      "NetworkManager/dnsmasq.d/dyndns.conf".text = concatMapStrings (n: ''
        hostsdir=/run/NetworkManager/hostsdirs/${n}
      '') (attrNames cfg.hostsDirs);
    };

  };
}


with import <nixpkgs> {};
let
   badvpnLocal = pkgs.badvpn.overrideDerivation (attrs: { src = stdenv.lib.cleanSource ./. ; });
in rec {
   badvpn = badvpnLocal;
   badvpnWithDebug = badvpnLocal.override { debug = true; };
}

Rewrite the Nix expression so it doesn't depend on the one in nixpkgs.

let
    badvpnLocal = (
        { stdenv, cmake, pkgconfig, openssl, nspr, nss, debug ? false }:
        let
            compileFlags = "-O3 ${stdenv.lib.optionalString (!debug) "-DNDEBUG"}";
        in
        stdenv.mkDerivation {
            name = "badvpn";
            nativeBuildInputs = [ cmake pkgconfig ];
            buildInputs = [ openssl nspr nss ];
            src = stdenv.lib.cleanSource ./.;
            preConfigure = ''
                cmakeFlagsArray=( "-DCMAKE_BUILD_TYPE=" "-DCMAKE_C_FLAGS=${compileFlags}" );
            '';
        }
    );
in
with import <nixpkgs> {};
rec {
   badvpn = pkgs.callPackage badvpnLocal {};
   badvpnDebug = pkgs.callPackage badvpnLocal { debug = true; };
}


# This script is used for building the program on NixOS with the proper dependencies.
# To use, simply run nix-shell in this directory and run "cargo build" as you normally would.

with import <nixpkgs> {};

stdenv.mkDerivation {
    name = "bcnotif";
    buildInputs = [ gcc dbus.dev pkgconfig openssl.dev ];
}


import ./make-test.nix ({ pkgs, ...} : {
  name = "emacs-daemon";
  meta = with pkgs.stdenv.lib.maintainers; {
    maintainers = [ DamienCassou ];
  };

  enableOCR = true;

  machine =
    { config, pkgs, ... }:

    { imports = [ ./common/x11.nix ];
      services.emacs = {
        enable = true;
        defaultEditor = true;
      };

      # Important to get the systemd service running for root
      environment.variables.XDG_RUNTIME_DIR = "/run/user/0";

      environment.variables.TEST_SYSTEM_VARIABLE = "system variable";
    };

  testScript =
    ''
      $machine->waitForUnit("multi-user.target");

      # checks that the EDITOR environment variable is set
      $machine->succeed("test \$(basename \"\$EDITOR\") = emacseditor");

      # waits for the emacs service to be ready
      $machine->waitUntilSucceeds("systemctl --user status emacs.service | grep 'Active: active'");

      # connects to the daemon
      $machine->succeed("emacsclient --create-frame \$EDITOR &");

      # checks that Emacs shows the edited filename
      $machine->waitForText("emacseditor");

      # makes sure environment variables are accessible from Emacs
      $machine->succeed("emacsclient --eval '(getenv \"TEST_SYSTEM_VARIABLE\")'") =~ /system variable/ or die;

      $machine->screenshot("emacsclient");
    '';
})


Add a nix package for the binary release

{ stdenv, fetchurl }:

stdenv.mkDerivation rec {
  version = "0.5.0";
  name = "openfairdb-${version}";
  src = fetchurl {
    url = "https://github.com/slowtec/openfairdb/releases/download/v${version}/openfairdb_x86_64-unknown-linux-musl_v${version}.tar.xz";
    sha256 = "1318j40ncfvcc8l34940m63fwh8nrrs3r498riwmqc4ihcrk1rs5";
  };

  sourceRoot = ".";

  installPhase = ''
    mkdir -p $out/bin
    install -D openfairdb $out/bin
  '';

  meta = with stdenv.lib; {
    description = "Mapping for Good";
    homepage = http://www.openfairdb.org;
    license = with licenses; [ agpl3 ];
    maintainers = [ maintainers.flosse ];
  };
}


Add file with GCE image locations, similar to ec2-amis.nix. Will be used by nixops.


{stdenv, fetchurl, automake, libiconv, vanilla ? false}:

stdenv.mkDerivation (rec {
  name = "pkg-config-0.29";

  setupHook = ./setup-hook.sh;

  src = fetchurl {
    url = "http://pkgconfig.freedesktop.org/releases/${name}.tar.gz";
    sha256 = "0sq09a39wj4cxf8l2jvkq067g08ywfma4v6nhprnf351s82pfl68";
  };

  buildInputs = stdenv.lib.optional (stdenv.isCygwin || stdenv.isDarwin) libiconv;

  configureFlags = [ "--with-internal-glib" ];

  patches = (if vanilla then [] else [
    # Process Requires.private properly, see
    # http://bugs.freedesktop.org/show_bug.cgi?id=4738.
    ./requires-private.patch
  ]) ++ stdenv.lib.optional stdenv.isCygwin ./2.36.3-not-win32.patch;

  meta = {
    description = "A tool that allows packages to find out information about other packages";
    homepage = http://pkg-config.freedesktop.org/wiki/;
    platforms = stdenv.lib.platforms.all;
  };

} // (if stdenv.system == "mips64el-linux" then
  {
    preConfigure = ''
      cp -v ${automake}/share/automake*/config.{sub,guess} .
    '';
  } else {}))

Make pkgconfig use proper i18n.

{stdenv, fetchurl, automake, libiconv, vanilla ? false}:

stdenv.mkDerivation (rec {
  name = "pkg-config-0.29";

  setupHook = ./setup-hook.sh;

  src = fetchurl {
    url = "http://pkgconfig.freedesktop.org/releases/${name}.tar.gz";
    sha256 = "0sq09a39wj4cxf8l2jvkq067g08ywfma4v6nhprnf351s82pfl68";
  };

  buildInputs = stdenv.lib.optional (stdenv.isCygwin || stdenv.isDarwin || stdenv.isSunOS) libiconv;

  configureFlags = [ "--with-internal-glib" ]
    ++ stdenv.lib.optional (stdenv.isSunOS) "--with-libiconv=gnu";

  patches = (if vanilla then [] else [
    # Process Requires.private properly, see
    # http://bugs.freedesktop.org/show_bug.cgi?id=4738.
    ./requires-private.patch
  ]) ++ stdenv.lib.optional stdenv.isCygwin ./2.36.3-not-win32.patch;

  meta = {
    description = "A tool that allows packages to find out information about other packages";
    homepage = http://pkg-config.freedesktop.org/wiki/;
    platforms = stdenv.lib.platforms.all;
  };

} // (if stdenv.system == "mips64el-linux" then
  {
    preConfigure = ''
      cp -v ${automake}/share/automake*/config.{sub,guess} .
    '';
  } else {}))


Add a NixOS module for provisioning DNS entries locally with NetworkManager/dnsmasq

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

with lib;

let

  cfg = config.networking.networkmanager.dynamichosts;

  enable = config.networking.networkmanager.enable && cfg.enable &&
    cfg.hostsDirs != {};

in {
  options = {
    networking.networkmanager.dynamichosts = {
      enable = mkOption {
        type = types.bool;
        default = false;
      };
      hostsDirs = mkOption {
        type = with types; attrsOf (submodule {
          options = {
            user = mkOption {
              type = types.str;
              default = "root";
            };
            group = mkOption {
              type = types.str;
              default = "root";
            };
          };
        });
        default = {};
      };
    };
  };

  config = mkIf enable {

    networking.networkmanager.useDnsmasq = true;

    systemd.services.nm-setup-hostsdirs = {
      wantedBy = [ "network-manager.service" ];
      before = [ "network-manager.service" ];
      partOf = [ "network-manager.service" ];
      script = concatStrings (mapAttrsToList (n: d: ''
        mkdir -p "/run/nm-hostsdirs/${n}"
        chown "${d.user}:${d.group}" "/run/nm-hostsdirs/${n}"
        chmod 0775 "/run/nm-hostsdirs/${n}"
      '') cfg.hostsDirs);
      serviceConfig = {
        Type = "oneshot";
        RemainAfterExist = true;
      };
    };

    environment.etc = {
      "NetworkManager/dnsmasq.d/dyndns.conf".text = concatMapStrings (n: ''
        hostsdir=/run/nm-hostsdirs/${n}
      '') (attrNames cfg.hostsDirs);
    };

  };
}


{
  imports = [
    ../../profiles/installation-device.nix
    ./sd-image-riscv64-qemu.nix
  ];

  # the installation media is also the installation target,
  # so we don't want to provide the installation configuration.nix.
  installer.cloneConfig = false;
}


{ stdenv, idris, packages }: stdenv.mkDerivation {
  inherit (idris) name;

  inherit packages;

  unpackPhase = ''
    cat >idris.c <<EOF
    #include <stdlib.h>
    #include <unistd.h>
    #include <stdio.h>

    int main (int argc, char ** argv) {
      /* idris currently only supports a single library path, so respect it if the user set it */
      setenv("IDRIS_LIBRARY_PATH", "$out/lib/${idris.name}", 0);
      execv("${idris}/bin/idris", argv);
      perror("executing ${idris}/bin/idris");
      return 127;
    }
    EOF
  '';

  buildPhase = ''
    gcc -O3 -o idris idris.c
  '';

  installPhase = ''
    mkdir -p $out/lib/${idris.name}
    for package in $packages
    do
      ln -sv $package/lib/${idris.name}/* $out/lib/${idris.name}
    done

    mkdir -p $out/bin
    mv idris $out/bin
  '';

  stripAllList = [ "bin" ];
}


/*

# New packages

READ THIS FIRST

This module is for official packages in the Plasma Mobile Gear. All
available packages are listed in `./srcs.nix`, although some are not yet
packaged in Nixpkgs.

IF YOUR PACKAGE IS NOT LISTED IN `./srcs.nix`, IT DOES NOT GO HERE.

See also `pkgs/applications/kde` as this is what this is based on.

# Updates

1. Update the URL in `./fetch.sh`.
2. Run `./maintainers/scripts/fetch-kde-qt.sh pkgs/applications/plasma-mobile`
   from the top of the Nixpkgs tree.
3. Use `nox-review wip` to check that everything builds.
4. Commit the changes and open a pull request.

*/

{ lib
, libsForQt5
, fetchurl
}:

let
  minQtVersion = "5.15";
  broken = lib.versionOlder libsForQt5.qtbase.version minQtVersion;

  mirror = "mirror://kde";
  srcs = import ./srcs.nix { inherit fetchurl mirror; };

  mkDerivation = args:
    let
      inherit (args) pname;
      inherit (srcs.${pname}) src version;
      mkDerivation =
        libsForQt5.callPackage ({ mkDerivation }: mkDerivation) {};
    in
      mkDerivation (args // {
        inherit pname version src;

        outputs = args.outputs or [ "out" ];

        meta =
          let meta = args.meta or {}; in
          meta // {
            homepage = meta.homepage or "https://www.plasma-mobile.org/";
            platforms = meta.platforms or lib.platforms.linux;
            broken = meta.broken or broken;
          };
      });

  packages = self: with self;
    let
      callPackage = self.newScope {
        inherit mkDerivation;
      };
    in {
    };

in lib.makeScope libsForQt5.newScope packages


{ config, lib, ... }:
{
  imports = [
    <nixpkgs/nixos/modules/installer/scan/not-detected.nix>
  ];

  boot.initrd.availableKernelModules = [ "ohci_pci" "ehci_pci" "ahci" "firewire_ohci" "usb_storage" "usbhid" "sd_mod" "sr_mod" ];
  boot.initrd.kernelModules = [ ];
  boot.kernelModules = [ "kvm-intel" "wl" ];
  boot.extraModulePackages = [ config.boot.kernelPackages.broadcom_sta ];

  ## CPU
  nix.maxJobs = lib.mkDefault 2;

  fileSystems = {
    "/" = {
      device = "/dev/disk/by-uuid/nixos";
      fsType = "ext4";
      options = [ "noatime" ];
    };
    "/boot" = {
      device = "/dev/disk/by-uuid/boot";
      fsType = "vfat";
    };
  };
  swapDevices = [{ device = "/dev/disk/by-uuid/swap"; }];
}

Add networking interface to aka's hardware cfg

{ config, lib, ... }:
{
  imports = [
    <nixpkgs/nixos/modules/installer/scan/not-detected.nix>
  ];

  boot.initrd.availableKernelModules = [ "ohci_pci" "ehci_pci" "ahci" "firewire_ohci" "usb_storage" "usbhid" "sd_mod" "sr_mod" ];
  boot.initrd.kernelModules = [ ];
  boot.kernelModules = [ "kvm-intel" "wl" ];
  boot.extraModulePackages = [ config.boot.kernelPackages.broadcom_sta ];

  ## CPU
  nix.maxJobs = lib.mkDefault 2;

  ## Networking
  networking.useDHCP = false;
  networking.interfaces.enp0s10.useDHCP = true;

  ## Harddrives
  fileSystems = {
    "/" = {
      device = "/dev/disk/by-uuid/nixos";
      fsType = "ext4";
      options = [ "noatime" ];
    };
    "/boot" = {
      device = "/dev/disk/by-uuid/boot";
      fsType = "vfat";
    };
  };
  swapDevices = [{ device = "/dev/disk/by-uuid/swap"; }];
}


{ stdenv
, fetchurl
}:

stdenv.mkDerivation rec {
  name = "apr-1.5.2";

  src = fetchurl {
    url = "mirror://apache/apr/${name}.tar.bz2";
    sha256 = "0ypn51xblix5ys9xy7da3ngdydip0qqh9rdq8nz54w9aq8lys0vx";
  };

  meta = with stdenv.lib; {
    description = "The Apache Portable Runtime library";
    homepage = https://apr.apache.org/;
    license = licenses.asl20;
    maintainers = with maintainers; [
      wkennington
    ];
    platforms = with platforms;
      i686-linux
      ++ x86_64-linux;
  };
}

Make it possbile to verify

{ stdenv
, fetchurl
}:

stdenv.mkDerivation rec {
  name = "apr-1.5.2";

  src = fetchurl {
    url = "mirror://apache/apr/${name}.tar.bz2";
    allowHashOutput = false;
    sha256 = "0ypn51xblix5ys9xy7da3ngdydip0qqh9rdq8nz54w9aq8lys0vx";
  };

  passthru = {
    srcVerified = fetchurl {
      failEarly = true;
      pgpsigUrls = map (n: "${n}.asc") src.urls;
      pgpKeyFingerprint = "5B51 81C2 C0AB 13E5 9DA3  F7A3 EC58 2EB6 39FF 092C";
      inherit (src) urls outputHash outputHashAlgo;
    };
  };

  meta = with stdenv.lib; {
    description = "The Apache Portable Runtime library";
    homepage = https://apr.apache.org/;
    license = licenses.asl20;
    maintainers = with maintainers; [
      wkennington
    ];
    platforms = with platforms;
      x86_64-linux;
  };
}


{ stdenv, fetchurl, readline, gettext, ncurses }:

with stdenv.lib;
stdenv.mkDerivation rec {
  name = "gnu-apl-${version}";
  version = "1.7";

  src = fetchurl {
    url = "mirror://gnu/apl/apl-${version}.tar.gz";
    sha256 = "07xq8ddlmz8psvsmwr23gar108ri0lwmw0n6kpxcv8ypas1f5xlg";
  };

  buildInputs = [ readline gettext ncurses ];

  patchPhase = optionalString stdenv.isDarwin ''
    substituteInPlace src/LApack.cc --replace "malloc.h" "malloc/malloc.h"
  '';

  postInstall = ''
    cp -r support-files/ $out/share/doc/
    find $out/share/doc/support-files -name 'Makefile*' -delete
  '';

  meta = {
    description = "Free interpreter for the APL programming language";
    homepage    = http://www.gnu.org/software/apl/;
    license     = licenses.gpl3Plus;
    maintainers = [ maintainers.kovirobi ];
    platforms   = with platforms; linux ++ darwin;
    inherit version;

    longDescription = ''
      GNU APL is a free interpreter for the programming language APL, with an
      (almost) complete implementation of ISO standard 13751 aka.  Programming
      Language APL, Extended.  GNU APL was written and is being maintained by
      Jürgen Sauermann.
    '';
  };
}

Fix build with GCC 7

{ stdenv, fetchurl, readline, gettext, ncurses }:

with stdenv.lib;
stdenv.mkDerivation rec {
  name = "gnu-apl-${version}";
  version = "1.7";

  src = fetchurl {
    url = "mirror://gnu/apl/apl-${version}.tar.gz";
    sha256 = "07xq8ddlmz8psvsmwr23gar108ri0lwmw0n6kpxcv8ypas1f5xlg";
  };

  buildInputs = [ readline gettext ncurses ];

  # Needed with GCC 7
  NIX_CFLAGS_COMPILE = "-Wno-error=int-in-bool-context";

  patchPhase = optionalString stdenv.isDarwin ''
    substituteInPlace src/LApack.cc --replace "malloc.h" "malloc/malloc.h"
  '';

  postInstall = ''
    cp -r support-files/ $out/share/doc/
    find $out/share/doc/support-files -name 'Makefile*' -delete
  '';

  meta = {
    description = "Free interpreter for the APL programming language";
    homepage    = http://www.gnu.org/software/apl/;
    license     = licenses.gpl3Plus;
    maintainers = [ maintainers.kovirobi ];
    platforms   = with platforms; linux ++ darwin;
    inherit version;

    longDescription = ''
      GNU APL is a free interpreter for the programming language APL, with an
      (almost) complete implementation of ISO standard 13751 aka.  Programming
      Language APL, Extended.  GNU APL was written and is being maintained by
      Jürgen Sauermann.
    '';
  };
}


{stdenv, fetchurl }:

let

  rev = "b7bbd3d1683e9f3bb11ef86b952adee71e83862f";

in stdenv.mkDerivation {
  name = "raspberrypi-firmware-${rev}";

  src = fetchurl {
    url = "https://github.com/raspberrypi/firmware/archive/${rev}.tar.gz";
    sha256 = "16wpwa1y3imd3la477b3rfbfypssvlh0zjdag3hgkm33aysizijp";
  };

  installPhase = ''
    mkdir -p $out/share/raspberrypi/boot
    cp -R boot/* $out/share/raspberrypi/boot
    cp -R hardfp/opt/vc/* $out
    cp opt/vc/LICENCE $out/share/raspberrypi
  '';

  meta = {
    description = "Firmware for the Raspberry Pi board";
    homepage = https://github.com/raspberrypi;
    license = stdenv.lib.licenses.unfree;
  };
}

Patch the ELF binaries to set the correct dynamic linker and RPATH.

{stdenv, fetchurl }:

let

  rev = "b7bbd3d1683e9f3bb11ef86b952adee71e83862f";

in stdenv.mkDerivation {
  name = "raspberrypi-firmware-${rev}";

  src = fetchurl {
    url = "https://github.com/raspberrypi/firmware/archive/${rev}.tar.gz";
    sha256 = "16wpwa1y3imd3la477b3rfbfypssvlh0zjdag3hgkm33aysizijp";
  };

  installPhase = ''
    mkdir -p $out/share/raspberrypi/boot
    cp -R boot/* $out/share/raspberrypi/boot
    cp -R hardfp/opt/vc/* $out
    cp opt/vc/LICENCE $out/share/raspberrypi

    for f in $out/bin/*; do
      patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" "$f"
      patchelf --set-rpath "$out/lib" "$f"
    done
  '';

  meta = {
    description = "Firmware for the Raspberry Pi board";
    homepage = https://github.com/raspberrypi;
    license = stdenv.lib.licenses.unfree;
  };
}


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

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

  src = fetchurl {
    url = "https://github.com/chaos/diod/archive/${version}.tar.gz";
    sha256 = "1864i42a4rm3f1q68nc19kcshc0hcf6zfgsdq0ppmmwry4mrvij0";
  };

  buildInputs = [ munge lua5 libcap perl ncurses ];

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

Update from 1.0.21 to 1.0.22

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

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

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

  buildInputs = [ munge lua5 libcap perl ncurses ];

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


{ stdenv, buildPythonPackage, fetchPypi, isPy3k
, google_api_python_client, simplejson, oauth2client
}:

buildPythonPackage rec {
  pname = "goobook";
  version = "3.4";
  disabled = !isPy3k;

  src = fetchPypi {
    inherit pname version;
    sha256 = "089a95s6g9izsy1fzpz48p6pz0wpngcbbrvsillm1n53492gfhjg";
  };

  propagatedBuildInputs = [ google_api_python_client simplejson oauth2client ];

  meta = with stdenv.lib; {
    description = "Search your google contacts from the command-line or mutt";
    homepage    = https://pypi.python.org/pypi/goobook;
    license     = licenses.gpl3;
    maintainers = with maintainers; [ primeos ];
    platforms   = platforms.unix;
  };
}

Add the missing setuptools dependency

{ stdenv, buildPythonPackage, fetchPypi, isPy3k
, google_api_python_client, simplejson, oauth2client, setuptools
}:

buildPythonPackage rec {
  pname = "goobook";
  version = "3.4";
  disabled = !isPy3k;

  src = fetchPypi {
    inherit pname version;
    sha256 = "089a95s6g9izsy1fzpz48p6pz0wpngcbbrvsillm1n53492gfhjg";
  };

  propagatedBuildInputs = [
    google_api_python_client simplejson oauth2client setuptools
  ];

  meta = with stdenv.lib; {
    description = "Search your google contacts from the command-line or mutt";
    homepage    = https://pypi.python.org/pypi/goobook;
    license     = licenses.gpl3;
    maintainers = with maintainers; [ primeos ];
    platforms   = platforms.unix;
  };
}


# Create a python that knows about additional python packages via
# PYTHONPATH

{stdenv, python, makeWrapper, extraLibs ? []}:

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

  buildInputs = [ makeWrapper ];
  propagatedBuildInputs = [ python ] ++ extraLibs;

  unpackPhase = "true";
  installPhase = ''
    mkdir -p "$out/bin"
    for prg in 2to3 idle pydoc python python-config python${python.majorVersion} python${python.majorVersion}-config smtpd.py; do
      makeWrapper "$python/bin/$prg" "$out/bin/$prg" --suffix PYTHONPATH : "$PYTHONPATH"
    done
    ensureDir "$out/share"
    ln "$python/share/man" "$out/share/man" -s
  '';

  inherit python;
  inherit (python) meta;
}

Revert "do not propagate makeWrapper via pythonXYFull"

# Create a python that knows about additional python packages via
# PYTHONPATH

{stdenv, python, makeWrapper, extraLibs ? []}:

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

  propagatedBuildInputs = [python makeWrapper] ++ extraLibs;

  unpackPhase = "true";
  installPhase = ''
    mkdir -p "$out/bin"
    for prg in 2to3 idle pydoc python python-config python${python.majorVersion} python${python.majorVersion}-config smtpd.py; do
      makeWrapper "$python/bin/$prg" "$out/bin/$prg" --suffix PYTHONPATH : "$PYTHONPATH"
    done
    ensureDir "$out/share"
    ln "$python/share/man" "$out/share/man" -s
  '';

  inherit python;
  inherit (python) meta;
}


{ pkgs ? (import <nixpkgs> {}) }:

let
  env = with pkgs.rustPlatform; [
    rustc
    cargo
  ];
in

pkgs.stdenv.mkDerivation rec {
    name = "imag";
    src = ./.;
    version = "0.0.0";

    buildInputs = [ env ];

}

Switch to pkgs.rustUnstable, so we do not need to rebuild rustc (wtf?)

{ pkgs ? (import <nixpkgs> {}) }:

let
  env = with pkgs.rustUnstable; [
    rustc
    cargo
  ];
in

pkgs.stdenv.mkDerivation rec {
    name = "imag";
    src = ./.;
    version = "0.0.0";

    buildInputs = [ env ];

}


{ lib, buildPythonPackage, fetchPypi, pydns }:

buildPythonPackage rec {
  pname = "pyspf";
  version = "2.0.13";

  src = fetchPypi {
    inherit pname version;
    sha256 = "16wjj99d2pikz6z1gwnl1jjvad6qjgpsf3a85lh47qqrjpiipp32";
  };

  propagatedBuildInputs = [ pydns ];

  meta = with lib; {
    homepage = http://bmsi.com/python/milter.html;
    description = "Python API for Sendmail Milters (SPF)";
    maintainers = with maintainers; [ abbradar ];
    license = licenses.gpl2;
  };
}

Revert "python37Packages.pyspf: 2.0.12 -> 2.0.13"

{ lib, buildPythonPackage, fetchPypi, pydns }:

buildPythonPackage rec {
  pname = "pyspf";
  version = "2.0.12"; # version 2.0.13 should not be used, see #72791

  src = fetchPypi {
    inherit pname version;
    sha256 = "18j1rmbmhih7q6y12grcj169q7sx1986qn4gmpla9y5gwfh1p8la";
  };

  propagatedBuildInputs = [ pydns ];

  meta = with lib; {
    homepage = http://bmsi.com/python/milter.html;
    description = "Python API for Sendmail Milters (SPF)";
    maintainers = with maintainers; [ abbradar ];
    license = licenses.gpl2;
  };
}


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

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

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

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

  createFindlibDestdir = true;

  configurePhase = "true";	# Skip configure phase

  meta = with stdenv.lib; {
    homepage = "https://bitbucket.org/mmottl/pcre-ocaml";
    description = "An efficient C-library for pattern matching with Perl-style regular expressions in OCaml";
    license = licenses.lgpl21;
    platforms = ocaml.meta.platforms;
    maintainers = with maintainers; [ z77z vbmithr ];
  };
}

Update ocaml-pcre to version 7.1.1

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

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

  src = fetchurl {
    url = https://github.com/mmottl/pcre-ocaml/releases/download/v7.1.1/pcre-ocaml-7.1.1.tar.gz;
    sha256 = "0nj4gb6hjjjmz5gnl9cjrh4w82rw8cvbwnk0hxhfgfd25p9k50n3";
  };

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

  createFindlibDestdir = true;

  configurePhase = "true";	# Skip configure phase

  meta = with stdenv.lib; {
    homepage = "https://bitbucket.org/mmottl/pcre-ocaml";
    description = "An efficient C-library for pattern matching with Perl-style regular expressions in OCaml";
    license = licenses.lgpl21;
    platforms = ocaml.meta.platforms;
    maintainers = with maintainers; [ z77z vbmithr ];
  };
}


{ stdenv, fetchurl, which, screen }:

let
  name = "wdiff-1.1.0";
in
stdenv.mkDerivation {
  inherit name;

  src = fetchurl {
    url = "mirror://gnu/wdiff/${name}.tar.gz";
    sha256 = "1lg5lz78xij4jjifv8fj68ixr9mha1c5vp8xzyg6rdx6ynkvnm5i";
  };

  # Required for the compile-time for the test suite.
  buildInputs = [ which screen ];

  doCheck = true;

  meta = {
    homepage = http://www.gnu.org/software/wdiff/;
    description = "GNU wdiff, comparing files on a word by word basis";
    license = "GPLv3+";
    maintainers = [ stdenv.lib.maintainers.eelco stdenv.lib.maintainers.ludo ];
    platforms = stdenv.lib.platforms.all;
  };
}

Update to 1.1.2 to fix the build

{ stdenv, fetchurl, which, screen }:

stdenv.mkDerivation rec {
  name = "wdiff-1.1.2";

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

  # Required for the compile-time for the test suite.
  buildInputs = [ which screen ];

  doCheck = true;

  meta = {
    homepage = http://www.gnu.org/software/wdiff/;
    description = "GNU wdiff, comparing files on a word by word basis";
    license = "GPLv3+";
    maintainers = [ stdenv.lib.maintainers.eelco stdenv.lib.maintainers.ludo ];
    platforms = stdenv.lib.platforms.all;
  };
}


{ stdenv, fetchFromGitHub, ocaml, findlib }:
let
  version = "0.13.0";
in
stdenv.mkDerivation {
  name = "ocamlbuild-${version}";
  inherit version;

  src = fetchFromGitHub {
    owner = "ocaml";
    repo = "ocamlbuild";
    rev = version;
    sha256 = "13r9q8c209gkgcmbjhj9z4r5bmi90rxahdsiqm5jx8sr2pia5xbh";
  };

  createFindlibDestdir = true;

  buildInputs = [ ocaml findlib ];

  configurePhase = ''
  make -f configure.make Makefile.config \
    "OCAMLBUILD_PREFIX=$out" \
    "OCAMLBUILD_BINDIR=$out/bin" \
    "OCAMLBUILD_MANDIR=$out/share/man" \
    "OCAMLBUILD_LIBDIR=$OCAMLFIND_DESTDIR"
  '';

  meta = with stdenv.lib; {
    homepage = https://github.com/ocaml/ocamlbuild/;
    description = "A build system with builtin rules to easily build most OCaml projects";
    license = licenses.lgpl2;
    inherit (ocaml.meta) platforms;
    maintainers = with maintainers; [ vbgl ];
  };
}

Revert "ocamlPackages.ocamlbuild: 0.12.0 -> 0.13.0"

{ stdenv, fetchFromGitHub, ocaml, findlib }:
let
  version = "0.12.0";
in
stdenv.mkDerivation {
  name = "ocamlbuild-${version}";
  inherit version;

  src = fetchFromGitHub {
    owner = "ocaml";
    repo = "ocamlbuild";
    rev = version;
    sha256 = "1shyim50ms0816fphc4mk0kldcx3pnba2i6m10q0cbm18m9d7chq";
  };

  createFindlibDestdir = true;

  buildInputs = [ ocaml findlib ];

  configurePhase = ''
  make -f configure.make Makefile.config \
    "OCAMLBUILD_PREFIX=$out" \
    "OCAMLBUILD_BINDIR=$out/bin" \
    "OCAMLBUILD_MANDIR=$out/share/man" \
    "OCAMLBUILD_LIBDIR=$OCAMLFIND_DESTDIR"
  '';

  meta = with stdenv.lib; {
    homepage = https://github.com/ocaml/ocamlbuild/;
    description = "A build system with builtin rules to easily build most OCaml projects";
    license = licenses.lgpl2;
    inherit (ocaml.meta) platforms;
    maintainers = with maintainers; [ vbgl ];
  };
}


{ cabal, ansiTerminal, deepseq, doctest, filepath, ghcPaths
, hspecExpectations, hspecMeta, HUnit, QuickCheck, quickcheckIo
, random, setenv, silently, tfRandom, time, transformers
}:

cabal.mkDerivation (self: {
  pname = "hspec";
  version = "1.9.5";
  sha256 = "0y9gbm5rwwn80yzdllh1amaih4vxa61i9dzym88jr2kkwjrhxay4";
  isLibrary = true;
  isExecutable = true;
  buildDepends = [
    ansiTerminal deepseq filepath hspecExpectations HUnit QuickCheck
    quickcheckIo random setenv tfRandom time transformers
  ];
  testDepends = [
    ansiTerminal deepseq doctest filepath ghcPaths hspecExpectations
    hspecMeta HUnit QuickCheck quickcheckIo random setenv silently
    tfRandom time transformers
  ];
  doCheck = false;
  meta = {
    homepage = "http://hspec.github.io/";
    description = "Behavior-Driven Development for Haskell";
    license = self.stdenv.lib.licenses.mit;
    platforms = self.ghc.meta.platforms;
  };
})

Update haskell-hspec to version 1.10.0

{ cabal, ansiTerminal, async, deepseq, doctest, filepath, ghcPaths
, hspecExpectations, hspecMeta, HUnit, QuickCheck, quickcheckIo
, random, setenv, silently, tfRandom, time, transformers
}:

cabal.mkDerivation (self: {
  pname = "hspec";
  version = "1.10.0";
  sha256 = "0lqc4sxl2c1rgnmp4a2fikc78f9caxswkmxfi8wajxlwaj58sy8p";
  isLibrary = true;
  isExecutable = true;
  buildDepends = [
    ansiTerminal async deepseq filepath hspecExpectations HUnit
    QuickCheck quickcheckIo random setenv tfRandom time transformers
  ];
  testDepends = [
    ansiTerminal async deepseq doctest filepath ghcPaths
    hspecExpectations hspecMeta HUnit QuickCheck quickcheckIo random
    setenv silently tfRandom time transformers
  ];
  doCheck = false;
  meta = {
    homepage = "http://hspec.github.io/";
    description = "Behavior-Driven Development for Haskell";
    license = self.stdenv.lib.licenses.mit;
    platforms = self.ghc.meta.platforms;
  };
})


{ lib, pythonPackages, fetchurl, kmod, systemd }:

let version = "0.7.9";

in pythonPackages.buildPythonApplication rec {
  name = "cloud-init-${version}";
  namePrefix = "";

  src = fetchurl {
    url = "https://launchpad.net/cloud-init/trunk/${version}/+download/cloud-init-${version}.tar.gz";
    sha256 = "0wnl76pdcj754pl99wxx76hkir1s61x0bg0lh27sdgdxy45vivbn";
  };

  patches = [ ./add-nixos-support.patch ];
  patchPhase = ''
    patchShebangs ./tools

    substituteInPlace setup.py \
      --replace /usr $out \
      --replace /etc $out/etc \
      --replace /lib/systemd $out/lib/systemd \
      --replace 'self.init_system = ""' 'self.init_system = "systemd"'

    patchPhase
    '';

  propagatedBuildInputs = with pythonPackages; [ cheetah jinja2 prettytable
    oauthlib pyserial configobj pyyaml argparse requests jsonpatch ];

  meta = {
    homepage = http://cloudinit.readthedocs.org;
    description = "Provides configuration and customization of cloud instance";
    maintainers = [ lib.maintainers.madjar lib.maintainers.phile314 ];
    platforms = lib.platforms.all;
  };
}

Use prePatch instead of patchPhase hack.

{ lib, pythonPackages, fetchurl, kmod, systemd }:

let version = "0.7.9";

in pythonPackages.buildPythonApplication rec {
  name = "cloud-init-${version}";
  namePrefix = "";

  src = fetchurl {
    url = "https://launchpad.net/cloud-init/trunk/${version}/+download/cloud-init-${version}.tar.gz";
    sha256 = "0wnl76pdcj754pl99wxx76hkir1s61x0bg0lh27sdgdxy45vivbn";
  };

  patches = [ ./add-nixos-support.patch ];
  prePatch = ''
    patchShebangs ./tools

    substituteInPlace setup.py \
      --replace /usr $out \
      --replace /etc $out/etc \
      --replace /lib/systemd $out/lib/systemd \
      --replace 'self.init_system = ""' 'self.init_system = "systemd"'
    '';

  propagatedBuildInputs = with pythonPackages; [ cheetah jinja2 prettytable
    oauthlib pyserial configobj pyyaml argparse requests jsonpatch ];

  meta = {
    homepage = http://cloudinit.readthedocs.org;
    description = "Provides configuration and customization of cloud instance";
    maintainers = [ lib.maintainers.madjar lib.maintainers.phile314 ];
    platforms = lib.platforms.all;
  };
}


{
  packageOverrides = pkgs: with pkgs; {
    myPackages = pkgs.buildEnv {
      name = "my-packages";
      paths = [
        ag
        appimage-run
        augeas
        autojump
        bridge-utils
        curl
        dnsmasq
        file
        fuse
        fzf
        git
        gnused
        gptfdisk
        homesick
        htop
        inetutils
        less
        lxc
        lxd
        man
        man-pages
        nodejs-11_x
        openssh
        qemu
        rclone
        readline70
        (ruby_2_6.overrideAttrs (attrs: {
          meta.priority = 3;
        }))
        socat
        tig
        tmux
        vim
        wget
        xorg.xset
        zsh
      ];
    };
  };
}

Replace Nix vim with vimHugeX

{
  packageOverrides = pkgs: with pkgs; {
    myPackages = pkgs.buildEnv {
      name = "my-packages";
      paths = [
        ag
        appimage-run
        augeas
        autojump
        bridge-utils
        curl
        dnsmasq
        file
        fuse
        fzf
        git
        gnused
        gptfdisk
        homesick
        htop
        inetutils
        less
        lxc
        lxd
        man
        man-pages
        nodejs-11_x
        openssh
        qemu
        rclone
        readline70
        (ruby_2_6.overrideAttrs (attrs: {
          meta.priority = 3;
        }))
        socat
        tig
        tmux
        (vimHugeX.overrideAttrs (attrs: {
          meta.priority = 3;
        }))
        wget
        xorg.xset
        zsh
      ];
    };
  };
}


{ lib
, stdenv
, fetchurl
, nixos
, testers
, hello
}:

stdenv.mkDerivation rec {
  pname = "hello";
  version = "2.12";

  src = fetchurl {
    url = "mirror://gnu/hello/${pname}-${version}.tar.gz";
    sha256 = "1ayhp9v4m4rdhjmnl2bq3cibrbqqkgjbl3s7yk2nhlh8vj3ay16g";
  };

  doCheck = true;

  passthru.tests = {
    version = testers.testVersion { package = hello; };

    invariant-under-noXlibs =
      testers.testEqualDerivation
        "hello must not be rebuilt when environment.noXlibs is set."
        hello
        (nixos { environment.noXlibs = true; }).pkgs.hello;
  };

  meta = with lib; {
    description = "A program that produces a familiar, friendly greeting";
    longDescription = ''
      GNU Hello is a program that prints "Hello, world!" when you run it.
      It is fully customizable.
    '';
    homepage = "https://www.gnu.org/software/hello/manual/";
    changelog = "https://git.savannah.gnu.org/cgit/hello.git/plain/NEWS?h=v${version}";
    license = licenses.gpl3Plus;
    maintainers = [ maintainers.eelco ];
    platforms = platforms.all;
  };
}

Define a passthru test via new mkDerivation self arg

{ lib
, runCommand
, stdenv
, fetchurl
, nixos
, testers
, hello
}:

stdenv.mkDerivation (self: {
  pname = "hello";
  version = "2.12";

  src = fetchurl {
    url = "mirror://gnu/hello/${self.pname}-${self.version}.tar.gz";
    sha256 = "1ayhp9v4m4rdhjmnl2bq3cibrbqqkgjbl3s7yk2nhlh8vj3ay16g";
  };

  doCheck = true;

  passthru.tests = {
    version = testers.testVersion { package = hello; };

    invariant-under-noXlibs =
      testers.testEqualDerivation
        "hello must not be rebuilt when environment.noXlibs is set."
        hello
        (nixos { environment.noXlibs = true; }).pkgs.hello;
  };

  passthru.tests.run = runCommand "hello-test-run" {
    nativeBuildInputs = [ self ];
  } ''
    diff -U3 --color=auto <(hello) <(echo 'Hello, world!')
    touch $out
  '';

  meta = with lib; {
    description = "A program that produces a familiar, friendly greeting";
    longDescription = ''
      GNU Hello is a program that prints "Hello, world!" when you run it.
      It is fully customizable.
    '';
    homepage = "https://www.gnu.org/software/hello/manual/";
    changelog = "https://git.savannah.gnu.org/cgit/hello.git/plain/NEWS?h=v${self.version}";
    license = licenses.gpl3Plus;
    maintainers = [ maintainers.eelco ];
    platforms = platforms.all;
  };
})


{ rustPlatform, fetchFromGitHub, lib, python, cmake, llvmPackages, clang, stdenv, darwin }:

rustPlatform.buildRustPackage rec {
  pname = "wasmtime";
  version = "0.15.0";

  src = fetchFromGitHub {
    owner = "bytecodealliance";
    repo = "${pname}";
    rev = "v${version}";
    sha256 = "1df99iak0psydlg9m8f8qq4zyh4wbi5l4qgsdjr2lm74ci3483xy";
    fetchSubmodules = true;
  };

  cargoSha256 = "170bz48jrc1k2ylfmd3bcry0xpcxx8p3rzzv9mprlfmrfpb0b28r";

  nativeBuildInputs = [ python cmake clang ];
  buildInputs = [ llvmPackages.libclang ] ++
   lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.Security ];
  LIBCLANG_PATH = "${llvmPackages.libclang}/lib";

  doCheck = true;

  meta = with lib; {
    description = "Standalone JIT-style runtime for WebAssembly, using Cranelift";
    homepage = "https://github.com/CraneStation/wasmtime";
    license = licenses.asl20;
    maintainers = [ maintainers.matthewbauer ];
    platforms = platforms.unix;
  };
}

Disable test suite on darwin

{ rustPlatform, fetchFromGitHub, lib, python, cmake, llvmPackages, clang, stdenv, darwin }:

rustPlatform.buildRustPackage rec {
  pname = "wasmtime";
  version = "0.15.0";

  src = fetchFromGitHub {
    owner = "bytecodealliance";
    repo = "${pname}";
    rev = "v${version}";
    sha256 = "1df99iak0psydlg9m8f8qq4zyh4wbi5l4qgsdjr2lm74ci3483xy";
    fetchSubmodules = true;
  };

  cargoSha256 = "170bz48jrc1k2ylfmd3bcry0xpcxx8p3rzzv9mprlfmrfpb0b28r";

  nativeBuildInputs = [ python cmake clang ];
  buildInputs = [ llvmPackages.libclang ] ++
   lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.Security ];
  LIBCLANG_PATH = "${llvmPackages.libclang}/lib";

  # no test on darwin due to
  # https://github.com/bytecodealliance/wasmtime/issues/1556
  doCheck = !stdenv.isDarwin;

  meta = with lib; {
    description = "Standalone JIT-style runtime for WebAssembly, using Cranelift";
    homepage = "https://github.com/CraneStation/wasmtime";
    license = licenses.asl20;
    maintainers = [ maintainers.matthewbauer ];
    platforms = platforms.unix;
  };
}


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

{ cabal, binary, deepseq, filepath, HUnit, hxtCharproperties
, hxtRegexXmlschema, hxtUnicode, mtl, networkUri, parsec
}:

cabal.mkDerivation (self: {
  pname = "hxt";
  version = "9.3.1.9";
  sha256 = "1f0dri6v821cd7d3jkylnmx0y73z7yrnirl3x4jfcx8arscc27q9";
  buildDepends = [
    binary deepseq filepath HUnit hxtCharproperties hxtRegexXmlschema
    hxtUnicode mtl networkUri parsec
  ];
  configureFlags = "-fnetwork-uri";
  meta = {
    homepage = "http://www.fh-wedel.de/~si/HXmlToolbox/index.html";
    description = "A collection of tools for processing XML with Haskell";
    license = self.stdenv.lib.licenses.mit;
    platforms = self.ghc.meta.platforms;
    maintainers = with self.stdenv.lib.maintainers; [ fuuzetsu ];
  };
})

Revert "haskell-hxt: update to 9.3.1.9"

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

{ cabal, binary, deepseq, filepath, HUnit, hxtCharproperties
, hxtRegexXmlschema, hxtUnicode, mtl, networkUri, parsec
}:

cabal.mkDerivation (self: {
  pname = "hxt";
  version = "9.3.1.7";
  sha256 = "1dgdq2l9k8v36iahmkxxjmmv955f9gv6lq09nsah9zcscsgm0v2i";
  buildDepends = [
    binary deepseq filepath HUnit hxtCharproperties hxtRegexXmlschema
    hxtUnicode mtl networkUri parsec
  ];
  configureFlags = "-fnetwork-uri";
  meta = {
    homepage = "http://www.fh-wedel.de/~si/HXmlToolbox/index.html";
    description = "A collection of tools for processing XML with Haskell";
    license = self.stdenv.lib.licenses.mit;
    platforms = self.ghc.meta.platforms;
    maintainers = with self.stdenv.lib.maintainers; [ fuuzetsu ];
  };
})


{ fetchurl, stdenv }:

stdenv.mkDerivation rec {
  name = "rmlint-1.0.8";

  src = fetchurl {
    url = "https://github.com/downloads/sahib/rmlint/rmlint_1.0.8.tar.gz";
    sha256 = "bea39a5872b39d3596e756f242967bc5bde6febeb996fdcd63fbcf5bfdc75f01";
  };

  makeFlags="DESTDIR=$(out)";

  meta = {
    description = "A tool to remove duplicates and other lint";
    homepage = "https://github.com/sahib/rmlint";
    platforms = stdenv.lib.platforms.linux;
    license = stdenv.lib.licenses.gpl3;
  };
}

Install to /bin, not /usr/bin

{ fetchurl, stdenv }:

stdenv.mkDerivation rec {
  name = "rmlint-1.0.8";

  src = fetchurl {
    url = "https://github.com/downloads/sahib/rmlint/rmlint_1.0.8.tar.gz";
    sha256 = "bea39a5872b39d3596e756f242967bc5bde6febeb996fdcd63fbcf5bfdc75f01";
  };

  preConfigure = ''
    substituteInPlace Makefile.in \
      --replace "/usr/" "/"
  '';

  makeFlags="DESTDIR=$(out)";

  meta = {
    description = "A tool to remove duplicates and other lint";
    homepage = "https://github.com/sahib/rmlint";
    platforms = stdenv.lib.platforms.linux;
    license = stdenv.lib.licenses.gpl3;
  };
}


{stdenv, fetchurl, ncurses}:

stdenv.mkDerivation {
  name = "rogue-5.4.4";

  src = fetchurl {
    url = http://rogue.rogueforge.net/files/rogue5.4/rogue5.4.4-src.tar.gz;
    sha256 = "18g81274d0f7sr04p7h7irz0d53j6kd9j1y3zbka1gcqq0gscdvx";
  };

  buildInputs = [ ncurses ];

  meta = {
    homepage = http://rogue.rogueforge.net/rogue-5-4/;
    description = "The final version of the original Rogue game developed for the UNIX operating system";
    platforms = stdenv.lib.platforms.all;
    maintainers = [ stdenv.lib.maintainers.eelco ];
  };
}

Add alternative source archive URLs.

{stdenv, fetchurl, ncurses}:

stdenv.mkDerivation {
  name = "rogue-5.4.4";

  src = fetchurl {
    urls = [
      "http://pkgs.fedoraproject.org/repo/pkgs/rogue/rogue5.4.4-src.tar.gz/033288f46444b06814c81ea69d96e075/rogue5.4.4-src.tar.gz"
      "http://ftp.vim.org/ftp/pub/ftp/os/Linux/distr/slitaz/sources/packages-cooking/r/rogue5.4.4-src.tar.gz"
      "http://rogue.rogueforge.net/files/rogue5.4/rogue5.4.4-src.tar.gz"
    ];
    sha256 = "18g81274d0f7sr04p7h7irz0d53j6kd9j1y3zbka1gcqq0gscdvx";
  };

  buildInputs = [ ncurses ];

  meta = {
    homepage = http://rogue.rogueforge.net/rogue-5-4/;
    description = "The final version of the original Rogue game developed for the UNIX operating system";
    platforms = stdenv.lib.platforms.all;
    maintainers = [ stdenv.lib.maintainers.eelco ];
  };
}


{ fetchFromGitHub, pythonPackages, lib }:

with pythonPackages;
buildPythonApplication rec {
  pname = "MarkdownPP";
  version = "1.5.1";
  propagatedBuildInputs = [ pillow watchdog ];
  checkPhase = ''
    cd test
    PATH=$out/bin:$PATH ${python}/bin/${python.executable} test.py
  '';
  src = fetchFromGitHub {
    owner = "jreese";
    repo = "markdown-pp";
    rev = "v${version}";
    sha256 = "180i5wn9z6vdk2k2bh8345z3g80hj7zf5s2pq0h7k9vaxqpp7avc";
  };
  meta = with lib; {
    description = "Preprocessor for Markdown files to generate a table of contents and other documentation needs";
    license = licenses.mit;
    homepage = "https://github.com/jreese/markdown-pp";
    maintainers = with maintainers; [ zgrannan ];
  };
}

Change to python3 to fix watchdog dependency

{ lib
, fetchFromGitHub
, python3
}:

python3.pkgs.buildPythonApplication rec {
  pname = "MarkdownPP";
  version = "1.5.1";
  propagatedBuildInputs = with python3.pkgs; [ pillow watchdog ];
  checkPhase = ''
    cd test
    PATH=$out/bin:$PATH ${python3}/bin/${python3.executable} test.py
  '';
  src = fetchFromGitHub {
    owner = "jreese";
    repo = "markdown-pp";
    rev = "v${version}";
    sha256 = "180i5wn9z6vdk2k2bh8345z3g80hj7zf5s2pq0h7k9vaxqpp7avc";
  };
  meta = with lib; {
    description = "Preprocessor for Markdown files to generate a table of contents and other documentation needs";
    license = licenses.mit;
    homepage = "https://github.com/jreese/markdown-pp";
    maintainers = with maintainers; [ zgrannan ];
  };
}


{ stdenv, fetchurl, unzip }:

stdenv.mkDerivation rec {
  version = "d7e8c4cdcf";

  package-name = "numix-icon-theme-circle";

  name = "${package-name}-20150304";

  buildInputs = [ unzip ];

  src = fetchurl {
    url = "https://github.com/numixproject/${package-name}/archive/${version}.zip";
    sha256 = "672d6f4d000c4c75a64e0297f9609afab1035d082d7ab4f7abe3e2173cba9324";
  };

  dontBuild = true;

  installPhase = ''
    install -dm 755 $out/share/icons
    cp -dr --no-preserve='ownership' Numix-Circle{,-Light} $out/share/icons/
  '';

  meta = {
    description = "Numix icon theme (circle version)";
    homepage = https://numixproject.org;
    license = stdenv.lib.licenses.gpl3;
    platforms = stdenv.lib.platforms.all;
  };
}

Add myself as a maintainer

{ stdenv, fetchurl, unzip }:

stdenv.mkDerivation rec {
  version = "d7e8c4cdcf";

  package-name = "numix-icon-theme-circle";

  name = "${package-name}-20150304";

  buildInputs = [ unzip ];

  src = fetchurl {
    url = "https://github.com/numixproject/${package-name}/archive/${version}.zip";
    sha256 = "672d6f4d000c4c75a64e0297f9609afab1035d082d7ab4f7abe3e2173cba9324";
  };

  dontBuild = true;

  installPhase = ''
    install -dm 755 $out/share/icons
    cp -dr --no-preserve='ownership' Numix-Circle{,-Light} $out/share/icons/
  '';

  meta = with stdenv.lib; {
    description = "Numix icon theme (circle version)";
    homepage = https://numixproject.org;
    license = licenses.gpl3;
    platforms = platforms.all;
    maintainers = with maintainers; [ jgeerds ];
  };
}


{ stdenv, fetchurl }:

stdenv.mkDerivation rec {
  name = "hdparm-9.39";

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

  preBuild = ''
    makeFlagsArray=(sbindir=$out/sbin manprefix=$out)
  '';

  meta = {
    description = "A tool to get/set ATA/SATA drive parameters under Linux";
    homepage = http://sourceforge.net/projects/hdparm/;
    platforms = stdenv.lib.platforms.linux;
  };
}

Upgrade hdparm from 9.39 -> 9.43

{ stdenv, fetchurl }:

stdenv.mkDerivation rec {
  name = "hdparm-9.43";

  src = fetchurl {
    url = "mirror://sourceforge/hdparm/${name}.tar.gz";
    sha256 = "0amm2s67vzfgs0jv59jgj9pqkr6j9glj1chsj292263i94kr5gib";
  };

  preBuild = ''
    makeFlagsArray=(sbindir=$out/sbin manprefix=$out)
  '';

  meta = {
    description = "A tool to get/set ATA/SATA drive parameters under Linux";
    homepage = http://sourceforge.net/projects/hdparm/;
    platforms = stdenv.lib.platforms.linux;
  };
}


{ stdenv, fetchFromGitHub, rustPlatform }:

rustPlatform.buildRustPackage rec {
  pname = "dust";
  version = "0.5.1";

  src = fetchFromGitHub {
    owner = "bootandy";
    repo = "dust";
    rev = "v${version}";
    sha256 = "1l5fh7yl8mbgahvzfa251cyp8j5awqdl66jblz565b1wb536kig7";
    # Remove unicode file names which leads to different checksums on HFS+
    # vs. other filesystems because of unicode normalisation.
    extraPostFetch = ''
      rm -rf $out/src/test_dir3/
    '';
  };

  cargoSha256 = "1sjzcawyg1xsi4xrx2zwnj8yavzph8k1wgxsffgp55wghzypafwl";

  doCheck = false;

  meta = with stdenv.lib; {
    description = "du + rust = dust. Like du but more intuitive";
    homepage = "https://github.com/bootandy/dust";
    license = licenses.asl20;
    maintainers = [ maintainers.infinisil ];
    platforms = platforms.all;
  };
}

Change derivation name from dust to du-dust

{ stdenv, fetchFromGitHub, rustPlatform }:

rustPlatform.buildRustPackage rec {
  pname = "du-dust";
  version = "0.5.1";

  src = fetchFromGitHub {
    owner = "bootandy";
    repo = "dust";
    rev = "v${version}";
    sha256 = "1l5fh7yl8mbgahvzfa251cyp8j5awqdl66jblz565b1wb536kig7";
    # Remove unicode file names which leads to different checksums on HFS+
    # vs. other filesystems because of unicode normalisation.
    extraPostFetch = ''
      rm -rf $out/src/test_dir3/
    '';
  };

  cargoSha256 = "0s8z8cg9q0gfqm0ann8rkxwp5y25si97kgginh6b6lbnaai7y4fj";

  doCheck = false;

  meta = with stdenv.lib; {
    description = "du + rust = dust. Like du but more intuitive";
    homepage = "https://github.com/bootandy/dust";
    license = licenses.asl20;
    maintainers = [ maintainers.infinisil ];
    platforms = platforms.all;
  };
}


{ stdenv, fetchurl, pkgconfig, python, isPy3k, isPyPy, wxGTK, openglSupport ? true, pyopengl
, version, sha256, wrapPython, setuptools, ...
}:

assert wxGTK.unicode;

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

  disabled = isPy3k || isPyPy;
  doCheck = false;

  src = fetchurl {
    url = "mirror://sourceforge/wxpython/wxPython-src-${version}.tar.bz2";
    inherit sha256;
  };

  pythonPath = [ python setuptools ];
  buildInputs = [ python setuptools pkgconfig wxGTK (wxGTK.gtk) wrapPython ]  ++ stdenv.lib.optional openglSupport pyopengl;
  preConfigure = "cd wxPython";

  installPhase = ''
    ${python.interpreter} setup.py install WXPORT=gtk2 NO_HEADERS=1 BUILD_GLCANVAS=${if openglSupport then "1" else "0"} UNICODE=1 --prefix=$out
    wrapPythonPrograms
  '';

  passthru = { inherit wxGTK openglSupport; };
}

Fix runtime error due to library dependencies not in RUNPATH.

{ stdenv, fetchurl, pkgconfig, python, isPy3k, isPyPy, wxGTK, openglSupport ? true, pyopengl
, version, sha256, wrapPython, setuptools, libX11, ...
}:

assert wxGTK.unicode;

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

  disabled = isPy3k || isPyPy;
  doCheck = false;

  src = fetchurl {
    url = "mirror://sourceforge/wxpython/wxPython-src-${version}.tar.bz2";
    inherit sha256;
  };

  pythonPath = [ python setuptools ];
  buildInputs = [ python setuptools pkgconfig wxGTK (wxGTK.gtk) wrapPython libX11 ]  ++ stdenv.lib.optional openglSupport pyopengl;
  preConfigure = "cd wxPython";

  NIX_LDFLAGS = "-lX11 -lgdk-x11-2.0";

  installPhase = ''
    ${python.interpreter} setup.py install WXPORT=gtk2 NO_HEADERS=1 BUILD_GLCANVAS=${if openglSupport then "1" else "0"} UNICODE=1 --prefix=$out
    wrapPythonPrograms
  '';

  passthru = { inherit wxGTK openglSupport; };
}


{ stdenv, fetchFromGitHub, libiconv }:

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

  buildInputs = stdenv.lib.optionals stdenv.isDarwin [ libiconv ];

  src = fetchFromGitHub {
    owner = "chneukirchen";
    repo = "mblaze";
    rev = "v${version}";
    sha256 = "11x548dl2jy9cmgsakqrzfdq166whhk4ja7zkiaxrapkjmkf6pbh";
  };

  makeFlags = "PREFIX=$(out)";

  postInstall = ''
    install -Dm644 -t $out/share/zsh/site-functions contrib/_mblaze
  '';

  meta = with stdenv.lib; {
    homepage = https://github.com/chneukirchen/mblaze;
    description = "Unix utilities to deal with Maildir";
    license = licenses.cc0;
    platforms = platforms.all;
    maintainers = [ maintainers.ajgrf ];
  };
}

Add patch to fix Darwin build

{ stdenv, fetchFromGitHub, fetchpatch, libiconv }:

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

  buildInputs = stdenv.lib.optionals stdenv.isDarwin [ libiconv ];

  src = fetchFromGitHub {
    owner = "chneukirchen";
    repo = "mblaze";
    rev = "v${version}";
    sha256 = "11x548dl2jy9cmgsakqrzfdq166whhk4ja7zkiaxrapkjmkf6pbh";
  };

  patches = [
    (fetchpatch {
      url = "https://github.com/leahneukirchen/mblaze/commit/53151f4f890f302291eb8d3375dec4f8ecb66ed7.patch";
      sha256 = "1mcyrh053iiyzdhgm09g5h3a77np496whnc7jr4agpk1nkbcpfxc";
    })
  ];

  makeFlags = "PREFIX=$(out)";

  postInstall = ''
    install -Dm644 -t $out/share/zsh/site-functions contrib/_mblaze
  '';

  meta = with stdenv.lib; {
    homepage = https://github.com/chneukirchen/mblaze;
    description = "Unix utilities to deal with Maildir";
    license = licenses.cc0;
    platforms = platforms.all;
    maintainers = [ maintainers.ajgrf ];
  };
}


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

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

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

Install gh from nixpkgs directly

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

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


{ pkgs, system, distribution, invDistribution
, stateDir ? "/var"
, runtimeDir ? "${stateDir}/run"
, logDir ? "${stateDir}/log"
, cacheDir ? "${stateDir}/cache"
, tmpDir ? (if stateDir == "/var" then "/tmp" else "${stateDir}/tmp")
, forceDisableUserChange ? false
, processManager ? "systemd"
}:

let
  constructors = import ../../../nix-processmgmt/examples/service-containers-agnostic/constructors.nix {
    inherit pkgs stateDir runtimeDir logDir cacheDir tmpDir forceDisableUserChange processManager;
  };

  applicationServices = import ./services.nix {
    inherit pkgs system distribution invDistribution;
  };

  processType =
    if processManager == null then "managed-process"
    else if processManager == "sysvinit" then "sysvinit-script"
    else if processManager == "systemd" then "systemd-unit"
    else if processManager == "supervisord" then "supervisord-program"
    else if processManager == "bsdrc" then "bsdrc-script"
    else if processManager == "cygrunsrv" then "cygrunsrv-service"
    else if processManager == "launchd" then "launchd-daemon"
    else throw "Unknown process manager: ${processManager}";
in
rec {
  simpleWebappApache = constructors.simpleWebappApache {
    port = 80;
    serverAdmin = "root@localhost";
    enablePHP = true;
    documentRoot = "/var/www";
    type = processType;
  };

  mysql = constructors.mysql {
    port = 3306;
    type = processType;
  };
} // applicationServices

Use module from the process management framework to derive the Dysnomia module for a given process manager

{ pkgs, system, distribution, invDistribution
, stateDir ? "/var"
, runtimeDir ? "${stateDir}/run"
, logDir ? "${stateDir}/log"
, cacheDir ? "${stateDir}/cache"
, tmpDir ? (if stateDir == "/var" then "/tmp" else "${stateDir}/tmp")
, forceDisableUserChange ? false
, processManager ? "systemd"
}:

let
  constructors = import ../../../nix-processmgmt/examples/service-containers-agnostic/constructors.nix {
    inherit pkgs stateDir runtimeDir logDir cacheDir tmpDir forceDisableUserChange processManager;
  };

  applicationServices = import ./services.nix {
    inherit pkgs system distribution invDistribution;
  };

  processType = import ../../../nix-processmgmt/nixproc/derive-dysnomia-process-type.nix {
    inherit processManager;
  };
in
rec {
  simpleWebappApache = constructors.simpleWebappApache {
    port = 80;
    serverAdmin = "root@localhost";
    enablePHP = true;
    documentRoot = "/var/www";
    type = processType;
  };

  mysql = constructors.mysql {
    port = 3306;
    type = processType;
  };
} // applicationServices


# This file is autogenerated from update.sh in the same directory.
{
  beta = {
    sha256 = "1bdjnyc88lpvd0gf5xdmngniijv57phmnih4h896dn2y89dvzv9j";
    sha256bin64 = "0kc16xzh1g0nsxq8gjnh6a2p0a69q2irplwkbgi9wx9ldxl4rg88";
    version = "55.0.2883.21";
  };
  dev = {
    sha256 = "02zlz4b9rpd57hfzw5jpnzdx746cckdmkfqj8wmij8kxfjrl67m9";
    sha256bin64 = "00bg43k00shcabwv9wv1ipy9y0gwrr769rb18gpkj39xrmv3qzh7";
    version = "56.0.2897.0";
  };
  stable = {
    sha256 = "0zfxwygqjhq37agqpn34nvjwa8ijm7xc9l6hwv89m5rs1gmx60nj";
    sha256bin64 = "1mlqxglbqdqnhsmy1p6jn1z9md0lsia6lrhw11q7d523masvbb1m";
    version = "54.0.2840.71";
  };
}

Update all channels to latest versions

# This file is autogenerated from update.sh in the same directory.
{
  beta = {
    sha256 = "11a98nknz7lh5jmjslznccg11nr0wla4c9l40fvxqxjm2gs6qags";
    sha256bin64 = "0qdydj0i9ll72f5m9r48gc3dyc22q6qas5nq8h0mbnrxrwd9dnyj";
    version = "55.0.2883.35";
  };
  dev = {
    sha256 = "1pfgb5dnygyxiwfq6ini5s159c178zz7235npaag7k8gcc10ybnz";
    sha256bin64 = "14s185361inkqh8ykl94xhgv01z68gxqh7j6gyb4jbr0rhcsd9pl";
    version = "56.0.2906.0";
  };
  stable = {
    sha256 = "01h1qkdw5dpwz61dybpf4bhag198j082lzwpkdx2nj55k2j3lawl";
    sha256bin64 = "18mxgzi79qhi07wgyyx6bb0lqm9pzkw85ypg6vmqv8gh0abn7dn1";
    version = "54.0.2840.90";
  };
}


{ config, pkgs, ... }:

{
  imports =
    [ ../virtualisation/virtualbox-image.nix
      ../installer/cd-dvd/channel.nix
      ../profiles/demo.nix
      ../profiles/clone-config.nix
    ];
}

Add the demo user to the vboxsf group to allow mounting of shared folders

{ config, pkgs, ... }:

{
  imports =
    [ ../virtualisation/virtualbox-image.nix
      ../installer/cd-dvd/channel.nix
      ../profiles/demo.nix
      ../profiles/clone-config.nix
    ];

  # Allow mounting of shared folders.
  users.extraUsers.demo.extraGroups = [ "vboxsf" ];
}


{ lib, buildPythonPackage, fetchPypi, jsonschema, notebook }:
buildPythonPackage rec {
  pname = "jupyterlab_launcher";
  version = "0.11.0";

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

  propagatedBuildInputs = [
    jsonschema
    notebook
  ];

  # depends on requests and a bunch of other libraries
  doCheck = false;

  meta = with lib; {
    description = "This package is used to launch an application built using JupyterLab";
    license = with licenses; [ bsd3 ];
    homepage = "http://jupyter.org/";
    maintainers = with maintainers; [ zimbatm ];
  };
}

Revert "python: jupyterlab_launcher: 0.10.5 -> 0.11.0"

{ lib, buildPythonPackage, fetchPypi, jsonschema, notebook }:
buildPythonPackage rec {
  pname = "jupyterlab_launcher";
  version = "0.10.5";

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

  propagatedBuildInputs = [
    jsonschema
    notebook
  ];

  # depends on requests and a bunch of other libraries
  doCheck = false;

  meta = with lib; {
    description = "This package is used to launch an application built using JupyterLab";
    license = with licenses; [ bsd3 ];
    homepage = "http://jupyter.org/";
    maintainers = with maintainers; [ zimbatm ];
  };
}


{ stdenv
, overrideDerivation

# required for gcc plugins
, gmp, libmpc, mpfr

# the base kernel
, kernel

, grsecPatch
, kernelPatches ? []

, localver ? "-grsec"
, modDirVersion ? "${kernel.version}${localver}"
, extraConfig ? ""
, ...
} @ args:

assert (kernel.version == grsecPatch.kver);

overrideDerivation (kernel.override {
  inherit modDirVersion;
  kernelPatches = [ grsecPatch ] ++ kernelPatches ++ (kernel.kernelPatches or []);
  inherit extraConfig;
  ignoreConfigErrors = true;
}) (attrs: {
  nativeBuildInputs = [ gmp libmpc mpfr ] ++ (attrs.nativeBuildInputs or []);
  preConfigure = ''
    echo ${localver} >localversion-grsec
    ${attrs.preConfigure or ""}
  '';
})

Fix build after multiple output shuffling

{ stdenv
, lib
, overrideDerivation

# required for gcc plugins
, gmp, libmpc, mpfr

# the base kernel
, kernel

, grsecPatch
, kernelPatches ? []

, localver ? "-grsec"
, modDirVersion ? "${kernel.version}${localver}"
, extraConfig ? ""
, ...
} @ args:

assert (kernel.version == grsecPatch.kver);

overrideDerivation (kernel.override {
  inherit modDirVersion;
  kernelPatches = [ grsecPatch ] ++ kernelPatches ++ (kernel.kernelPatches or []);
  inherit extraConfig;
  ignoreConfigErrors = true;
}) (attrs: {
  nativeBuildInputs = (lib.chooseDevOutputs [ gmp libmpc mpfr ]) ++ (attrs.nativeBuildInputs or []);
  preConfigure = ''
    echo ${localver} >localversion-grsec
    ${attrs.preConfigure or ""}
  '';
})


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

let
  extlinux-conf-builder =
    import ../../system/boot/loader/generic-extlinux-compatible/extlinux-conf-builder.nix {
      inherit pkgs;
    };
in
{
  imports = [
    ../../profiles/minimal.nix
    ../../profiles/installation-device.nix
    ./sd-image.nix
  ];

  assertions = lib.singleton {
    assertion = pkgs.stdenv.system == "armv7l-linux";
    message = "sd-image-armv7l-multiplatform.nix can be only built natively on ARMv7; " +
      "it cannot be cross compiled";
  };

  boot.loader.grub.enable = false;
  boot.loader.generic-extlinux-compatible.enable = true;

  # FIXME: change this to linuxPackages_latest once v4.2 is out
  boot.kernelPackages = pkgs.linuxPackages_testing;
  boot.kernelParams = ["console=ttyS0,115200n8" "console=ttyAMA0,115200n8" "console=tty0"];

  # FIXME: this probably should be in installation-device.nix
  users.extraUsers.root.initialHashedPassword = "";

  sdImage = {
    populateBootCommands = ''
        ${extlinux-conf-builder} -t 3 -c ${config.system.build.toplevel} -d ./boot
    '';
  };
}

Use linuxPackages_latest in ARMv7 image

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

let
  extlinux-conf-builder =
    import ../../system/boot/loader/generic-extlinux-compatible/extlinux-conf-builder.nix {
      inherit pkgs;
    };
in
{
  imports = [
    ../../profiles/minimal.nix
    ../../profiles/installation-device.nix
    ./sd-image.nix
  ];

  assertions = lib.singleton {
    assertion = pkgs.stdenv.system == "armv7l-linux";
    message = "sd-image-armv7l-multiplatform.nix can be only built natively on ARMv7; " +
      "it cannot be cross compiled";
  };

  boot.loader.grub.enable = false;
  boot.loader.generic-extlinux-compatible.enable = true;

  boot.kernelPackages = pkgs.linuxPackages_latest;
  boot.kernelParams = ["console=ttyS0,115200n8" "console=ttyAMA0,115200n8" "console=tty0"];

  # FIXME: this probably should be in installation-device.nix
  users.extraUsers.root.initialHashedPassword = "";

  sdImage = {
    populateBootCommands = ''
        ${extlinux-conf-builder} -t 3 -c ${config.system.build.toplevel} -d ./boot
    '';
  };
}


{ stdenv, fetchurl, makeWrapper, curl }:

let

  v  = "20120807";

in stdenv.mkDerivation {

  name = "plowshare-git${v}";

  src = fetchurl {
    url = "http://plowshare.googlecode.com/files/plowshare-snapshot-git${v}.tar.gz";
    sha256 = "0clryfssaa4rjvsy760p51ppq1275lwvhm9jh3g4mi973xv4n8si";
  };

  buildInputs = [ makeWrapper curl ];

  phases = [ "unpackPhase" "installPhase" "fixupPhase" ];

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

    for fn in plow{del,down,list,up}; do
      wrapProgram "$out/bin/$fn" --prefix PATH : ${curl}/bin
    done
  '';

  meta = {
    description = ''
      A command-line download/upload tool for popular file sharing websites
    '';
    license = stdenv.lib.licenses.gpl3;
  };
}

Add quotes to wrapProgram's arguments

{ stdenv, fetchurl, makeWrapper, curl }:

let

  v  = "20120807";

in stdenv.mkDerivation {

  name = "plowshare-git${v}";

  src = fetchurl {
    url = "http://plowshare.googlecode.com/files/plowshare-snapshot-git${v}.tar.gz";
    sha256 = "0clryfssaa4rjvsy760p51ppq1275lwvhm9jh3g4mi973xv4n8si";
  };

  buildInputs = [ makeWrapper curl ];

  phases = [ "unpackPhase" "installPhase" "fixupPhase" ];

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

    for fn in plow{del,down,list,up}; do
      wrapProgram "$out/bin/$fn" --prefix PATH : "${curl}/bin"
    done
  '';

  meta = {
    description = ''
      A command-line download/upload tool for popular file sharing websites
    '';
    license = stdenv.lib.licenses.gpl3;
  };
}


{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
  moz_overlay = import (builtins.fetchTarball https://github.com/mozilla/nixpkgs-mozilla/archive/4521bc6.tar.gz);
  nixpkgs = import <nixpkgs> { overlays = [ moz_overlay ]; };
  rust-moz-overlay = (nixpkgs.latest.rustChannels.beta.rust.override { extensions = [ "rust-src" "rls-preview" "rust-analysis" "rustfmt-preview" ];});
in
  with nixpkgs;
  stdenv.mkDerivation {
    name = "env";
    buildInputs = [
      rust-moz-overlay
      openssl
      pkg-config
    ];
  }

Upgrade to nightly rust again, rocket needs it

let
  moz_overlay = import (builtins.fetchTarball https://github.com/mozilla/nixpkgs-mozilla/archive/8c007b60731c07dd7a052cce508de3bb1ae849b4.tar.gz);
  nixpkgs = import <nixpkgs> { overlays = [ moz_overlay ]; };
  rust-moz-overlay = (nixpkgs.latest.rustChannels.nightly.rust.override { extensions = [ "rust-src" "rust-analysis" "rustfmt-preview" ];});
in
  with nixpkgs;
  stdenv.mkDerivation {
    name = "env";
    buildInputs = [
      rust-moz-overlay
      openssl
      pkg-config
    ];
  }


{ stdenv, fetchurl, libelf }:

stdenv.mkDerivation rec {
  name = "libdwarf-20140805";

  src = fetchurl {
    url = "http://www.prevanders.net/${name}.tar.gz";
    sha256 = "1z5xz0w1yvk8swcqzx4dvnig94j51pns39jmipv5rl20qahik0nl";
  };

  configureFlags = "--enable-shared";

  preBuild = ''
    export LD_LIBRARY_PATH=`pwd`/libdwarf
  '';

  buildInputs = [ libelf ];

  installPhase = ''
    mkdir -p $out/lib $out/include $out/bin
    cp ./dwarfdump2/dwarfdump $out/bin/dwarfdump2
    cp ./dwarfdump/dwarfdump $out/bin/dwarfdump
    cp libdwarf/libdwarf.so $out/lib
    cp libdwarf/libdwarf.h libdwarf/dwarf.h $out/include
  '';

  meta = {
    homepage = http://www.prevanders.net/dwarf.html;
    license = stdenv.lib.licenses.gpl2;
  };
}

Revert "libdwarf: upgrade to the latest version"

{ stdenv, fetchurl, libelf }:

stdenv.mkDerivation rec {
  name = "libdwarf-20121130";

  src = fetchurl {
    url = http://reality.sgiweb.org/davea/libdwarf-20121130.tar.gz;
    sha256 = "1nfdfn5xf3n485pvpb853awyxxnvrg207i0wmrr7bhk8fcxdxbn0";
  };

  configureFlags = " --enable-shared --disable-nonshared";

  preConfigure = ''
    cd libdwarf
  '';
  buildInputs = [ libelf ];

  installPhase = ''
    mkdir -p $out/lib $out/include
    cp libdwarf.so $out/lib
    cp libdwarf.h dwarf.h $out/include
  '';

  meta = {
    homepage = http://reality.sgiweb.org/davea/dwarf.html;
  };
}


{stdenv, fetchurl}:

stdenv.mkDerivation {
  name = "libusb-0.1.12";

  # On non-linux, we get warnings compiling, and we don't want the
  # build to break.
  patchPhase = ''
    sed -i s/-Werror// Makefile.in
  '';

  src = fetchurl {
    url = mirror://sourceforge/libusb/libusb-0.1.12.tar.gz;
    sha256 = "0i4bacxkyr7xyqxbmb00ypkrv4swkgm0mghbzjsnw6blvvczgxip";
  };
}

Use libusb-compat instead of unmaintained libusb

{stdenv, fetchurl, pkgconfig, libusb1}:

stdenv.mkDerivation {
  name = "libusb-compat-0.1.5";

  buildInputs = [ pkgconfig libusb1 ];

  src = fetchurl {
    url = mirror://sourceforge/libusb/libusb-compat-0.1.5.tar.bz2;
    sha256 = "0nn5icrfm9lkhzw1xjvaks9bq3w6mjg86ggv3fn7kgi4nfvg8kj0";
  };
}


{ stdenv, fetchurl, libuuid, zlib }:

stdenv.mkDerivation {
  name = "xapian-1.3.1";

  src = fetchurl {
    url = http://oligarchy.co.uk/xapian/1.3.1/xapian-core-1.3.1.tar.gz;
    sha256 = "03z31z0xpj9a4aryr5hcq3y8wwv8qc1dn487ahzkfgir7rv0zvk4";
  };

  buildInputs = [ libuuid zlib ];

  configureFlags = [ "--program-suffix=" ];

  meta = {
    description = "Search engine library";
    homepage = "http://xapian.org";
    license = stdenv.lib.licenses.gpl2Plus;
    maintainers = [ stdenv.lib.maintainers.chaoflow ];
  };
}

Revert "xapian: update from 1.2.8 to 1.3.1"

{ stdenv, fetchurl, libuuid, zlib }:

stdenv.mkDerivation {
  name = "xapian-1.2.8";

  src = fetchurl {
    url = http://oligarchy.co.uk/xapian/1.2.8/xapian-core-1.2.8.tar.gz;
    sha256 = "00411ebac66a5592b87fc57ccfeb234c84b929ed23c185befb5df9929df3d4f9";
  };

  buildInputs = [ libuuid zlib ];

  meta = {
    description = "Search engine library";
    homepage = "http://xapian.org";
    license = stdenv.lib.licenses.gpl2Plus;
    maintainers = [ stdenv.lib.maintainers.chaoflow ];
  };
}


{ stdenv, fetchurl, unzip }:

stdenv.mkDerivation rec {
  name = "fira-code-${version}";
  version = "1.100";

  src = fetchurl {
    url = "https://github.com/tonsky/FiraCode/releases/download/${version}/FiraCode_${version}.zip";
    sha256 = "1fprryfy8b79ncya1jzbzbxs75kvr1zwinflr8sl3d2m1r5kl03x";
  };

  buildInputs = [ unzip ];
  phases = [ "unpackPhase" "installPhase" ];
  sourceRoot = ".";

  installPhase = ''
    mkdir -p $out/share/fonts/opentype
    cp -r *.otf $out/share/fonts/opentype
  '';

  meta = with stdenv.lib; {
    homepage = https://github.com/tonsky/FiraCode;
    description = "Monospace font with programming ligatures";
    longDescription = ''
      Fira Code is a monospace font extending the Fira Mono font with
      a set of ligatures for common programming multi-character
      combinations.
    '';
    license = licenses.ofl;
    maintainers = [ maintainers.rycee ];
    platforms = platforms.all;
  };
}

Revert change from cp -v to cp -r in fira-code.

{ stdenv, fetchurl, unzip }:

stdenv.mkDerivation rec {
  name = "fira-code-${version}";
  version = "1.100";

  src = fetchurl {
    url = "https://github.com/tonsky/FiraCode/releases/download/${version}/FiraCode_${version}.zip";
    sha256 = "1fprryfy8b79ncya1jzbzbxs75kvr1zwinflr8sl3d2m1r5kl03x";
  };

  buildInputs = [ unzip ];
  phases = [ "unpackPhase" "installPhase" ];
  sourceRoot = ".";

  installPhase = ''
    mkdir -p $out/share/fonts/opentype
    cp -v *.otf $out/share/fonts/opentype
  '';

  meta = with stdenv.lib; {
    homepage = https://github.com/tonsky/FiraCode;
    description = "Monospace font with programming ligatures";
    longDescription = ''
      Fira Code is a monospace font extending the Fira Mono font with
      a set of ligatures for common programming multi-character
      combinations.
    '';
    license = licenses.ofl;
    maintainers = [ maintainers.rycee ];
    platforms = platforms.all;
  };
}


{ config, pkgs, ... }:

{
  imports =
    [ ../virtualisation/virtualbox-image.nix
      ../installer/cd-dvd/channel.nix
      ../profiles/demo.nix
      ../profiles/clone-config.nix
    ];

  # Allow mounting of shared folders.
  users.extraUsers.demo.extraGroups = [ "vboxsf" ];
}

Add more video drivers to the VM image

{ config, pkgs, ... }:

{
  imports =
    [ ../virtualisation/virtualbox-image.nix
      ../installer/cd-dvd/channel.nix
      ../profiles/demo.nix
      ../profiles/clone-config.nix
    ];

  # Allow mounting of shared folders.
  users.extraUsers.demo.extraGroups = [ "vboxsf" ];

  # Add some more video drivers to give X11 a shot at working in
  # VMware and QEMU.
  services.xserver.videoDrivers = mkOverride 40 [ "virtualbox" "vmware" "cirrus" "vesa" ];
}


{ stdenv, fetchurl, zeromq }:

stdenv.mkDerivation rec {
  baseName="czmq";
  version="3.0.2";
  name="${baseName}-${version}";

  src = fetchurl {
    url = "http://download.zeromq.org/${name}.tar.gz";
    sha256 = "16k9awrhdsymx7dnmvqcnkaq8lz8x8zppy6sh7ls8prpd6mkkjlb";
  };

  # Needs to be propagated for the .pc file to work
  propagatedBuildInputs = [ zeromq ];

  meta = with stdenv.lib; {
    homepage = "http://czmq.zeromq.org/";
    description = "High-level C Binding for ZeroMQ";
    license = licenses.mpl20;
    platforms = platforms.all;
    maintainers = with maintainers; [ wkennington ];
  };
}

Fix build on Glibc 2.24

{ stdenv, fetchurl, zeromq }:

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

  src = fetchurl {
    url = "http://download.zeromq.org/${name}.tar.gz";
    sha256 = "16k9awrhdsymx7dnmvqcnkaq8lz8x8zppy6sh7ls8prpd6mkkjlb";
  };

  # Fix build on Glibc 2.24.
  NIX_CFLAGS_COMPILE = "-Wno-error=deprecated-declarations";

  # Needs to be propagated for the .pc file to work
  propagatedBuildInputs = [ zeromq ];

  meta = with stdenv.lib; {
    homepage = "http://czmq.zeromq.org/";
    description = "High-level C Binding for ZeroMQ";
    license = licenses.mpl20;
    platforms = platforms.all;
    maintainers = with maintainers; [ wkennington ];
  };
}


{ stdenv, fetchurl, pam, kerberos }:

stdenv.mkDerivation rec {
  name = "pam_krb5-2.4.9";

  src = fetchurl {
    url = "https://fedorahosted.org/releases/p/a/pam_krb5/${name}.tar.gz";
    sha256 = "0vcb35shzp406jvvz0pkgqm8qq1qzhgwmkl0nrm0wrrkqlr22rfb";
  };

  buildInputs = [ pam kerberos ];

  meta = with stdenv.lib; {
    homepage = https://fedorahosted.org/pam_krb5;
    description = "PAM module allowing PAM-aware applications to authenticate users by performing an AS exchange with a Kerberos KDC";
    longDescription = ''
      pam_krb5 can optionally convert Kerberos 5 credentials to Kerberos IV
      credentials and/or use them to set up AFS tokens for a user's session.
    '';
    platforms = platforms.linux;
    license = licenses.bsd3;
    maintainers = with maintainers; [ wkennington mornfall ];
  };
}

Use the eyrie version 4.7

{ stdenv, fetchurl, pam, kerberos }:

stdenv.mkDerivation rec {
  name = "pam-krb5-4.7";

  src = fetchurl {
    url = "http://archives.eyrie.org/software/kerberos/${name}.tar.gz";
    sha256 = "04klg9a2rhdz0a2dw4f0ybcm28vcbab6lrynwq7rm4sn0hnzakwv";
  };

  buildInputs = [ pam kerberos ];

  meta = with stdenv.lib; {
    homepage = http://www.eyrie.org/~eagle/software/pam-krb5/;
    description = "PAM module allowing PAM-aware applications to authenticate users by performing an AS exchange with a Kerberos KDC";
    longDescription = ''
      pam_krb5 can optionally convert Kerberos 5 credentials to Kerberos IV
      credentials and/or use them to set up AFS tokens for a user's session.
    '';
    platforms = platforms.linux;
    license = licenses.bsd3;
    maintainers = with maintainers; [ wkennington mornfall ];
  };
}


{stdenv, bash, which, autoconf, automake, fetchurl, coq}:

stdenv.mkDerivation rec {

  name = "coq-flocq-${coq.coq-version}-${version}";
  version = "2.5.0";

  src = fetchurl {
    url = "https://gforge.inria.fr/frs/download.php/file/33979/flocq-${version}.tar.gz";
    sha256 = "0v3qiaz7vxfc5nk8rxwi39mik7hm7p5kb040q2pimb69qgfl6vml";
  };

  buildInputs = [ coq.ocaml coq.camlp5 bash which autoconf automake ];
  propagatedBuildInputs = [ coq ];

  buildPhase = ''
    ${bash}/bin/bash autogen.sh
    ${bash}/bin/bash configure --libdir=$out/lib/coq/${coq.coq-version}/user-contrib/Flocq
    ./remake
  '';

  installPhase = ''
    ./remake install
  '';

  meta = with stdenv.lib; {
    homepage = http://flocq.gforge.inria.fr/;
    description = "A floating-point formalization for the Coq system";
    license = licenses.lgpl3;
    maintainers = with maintainers; [ jwiegley ];
    platforms = coq.meta.platforms;
  };

}

Revert "coqPackages.flocq: 2.4.0 -> 2.5.0"

{stdenv, bash, which, autoconf, automake, fetchurl, coq}:

stdenv.mkDerivation rec {

  name = "coq-flocq-${coq.coq-version}-${version}";
  version = "2.5.0";

  src = fetchurl {
    url = https://gforge.inria.fr/frs/download.php/file/35091/flocq-2.5.0.tar.gz;
    sha256 = "0v3qiaz7vxfc5nk8rxwi39mik7hm7p5kb040q2pimb69qgfl6vml";
  };

  buildInputs = [ coq.ocaml coq.camlp5 bash which autoconf automake ];
  propagatedBuildInputs = [ coq ];

  buildPhase = ''
    ${bash}/bin/bash autogen.sh
    ${bash}/bin/bash configure --libdir=$out/lib/coq/${coq.coq-version}/user-contrib/Flocq
    ./remake
  '';

  installPhase = ''
    ./remake install
  '';

  meta = with stdenv.lib; {
    homepage = http://flocq.gforge.inria.fr/;
    description = "A floating-point formalization for the Coq system";
    license = licenses.lgpl3;
    maintainers = with maintainers; [ jwiegley ];
    platforms = coq.meta.platforms;
  };

}


{stdenv, fetchurl, lzo, openssl, zlib}:

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

  src = fetchurl {
    url = "http://www.tinc-vpn.org/packages/tinc-${version}.tar.gz";
    sha256 = "04i88hr46nx3x3s71kasm9qrjhnn35icxh9zwchki47z2vgnpw5w";
  };

  buildInputs = [ lzo openssl zlib ];

  configureFlags = ''
    --localstatedir=/var
    --sysconfdir=/etc
  '';

  meta = {
    description = "VPN daemon with full mesh routing";
    longDescription = ''
      tinc is a Virtual Private Network (VPN) daemon that uses tunnelling and
      encryption to create a secure private network between hosts on the
      Internet.  It features full mesh routing, as well as encryption,
      authentication, compression and ethernet bridging.
    '';
    homepage="http://www.tinc-vpn.org/";
    license = stdenv.lib.licenses.gpl2Plus;
  };
}

Update from 1.0.23 to 1.0.24

{stdenv, fetchurl, lzo, openssl, zlib}:

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

  src = fetchurl {
    url = "http://www.tinc-vpn.org/packages/tinc-${version}.tar.gz";
    sha256 = "11xnz6lz917hq0zb544dvbxl0smlyjx65kv3181j4fcyygwmi3j9";
  };

  buildInputs = [ lzo openssl zlib ];

  configureFlags = ''
    --localstatedir=/var
    --sysconfdir=/etc
  '';

  meta = {
    description = "VPN daemon with full mesh routing";
    longDescription = ''
      tinc is a Virtual Private Network (VPN) daemon that uses tunnelling and
      encryption to create a secure private network between hosts on the
      Internet.  It features full mesh routing, as well as encryption,
      authentication, compression and ethernet bridging.
    '';
    homepage="http://www.tinc-vpn.org/";
    license = stdenv.lib.licenses.gpl2Plus;
  };
}


with import <nixpkgs> {}; {
  beatwaveEnv = stdenv.mkDerivation {
    name = "beatwave";
    buildInputs = [ stdenv sfml cmake ];
  };
}

Add rtags to dev env

with import <nixpkgs> {}; {
  beatwaveEnv = stdenv.mkDerivation {
    name = "beatwave";
    buildInputs = [ stdenv sfml cmake rtags ];
  };
}


{
  packageOverrides = pkgs: with pkgs; {
    myPackages = pkgs.buildEnv {
      name = "my-packages";
      paths = [
        aspell
        coreutils
        jq
        skim
        bat
      ];
      pathsToLink = [ "/share" "/bin" "/Applications" ];
    };
  };
}

Add pass and xclip to nix pkgs

{
  packageOverrides = pkgs: with pkgs; {
    myPackages = pkgs.buildEnv {
      name = "my-packages";
      paths = [
        aspell
        coreutils
        jq
        skim
        bat
        xclip
        pass
      ];
      pathsToLink = [ "/share" "/bin" "/Applications" ];
    };
  };
}


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

with lib;

let
  cfg = config.hardware.ckb-next;

in
  {
    options.hardware.ckb-next = {
      enable = mkEnableOption "the Corsair keyboard/mouse driver";

      package = mkOption {
        type = types.package;
        default = pkgs.ckb-next;
        defaultText = "pkgs.ckb-next";
        description = ''
          The package implementing the Corsair keyboard/mouse driver.
        '';
      };
    };

    config = mkIf cfg.enable {
      environment.systemPackages = [ cfg.package ];

      systemd.services.ckb-next = {
        description = "Corsair Keyboards and Mice Daemon";
        wantedBy = ["multi-user.target"];
        script = "exec ${cfg.package}/bin/ckb-next-daemon";
        serviceConfig = {
          Restart = "on-failure";
          StandardOutput = "syslog";
        };
      };
    };

    meta = {
      maintainers = with lib.maintainers; [ kierdavis ];
    };
  }

Add option to restrict access to the devices to a particular group

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

with lib;

let
  cfg = config.hardware.ckb-next;

in
  {
    options.hardware.ckb-next = {
      enable = mkEnableOption "the Corsair keyboard/mouse driver";

      gid = mkOption {
        type = types.nullOr types.int;
        default = null;
        example = 100;
        description = ''
          Limit access to the ckb daemon to a particular group.
        '';
      };

      package = mkOption {
        type = types.package;
        default = pkgs.ckb-next;
        defaultText = "pkgs.ckb-next";
        description = ''
          The package implementing the Corsair keyboard/mouse driver.
        '';
      };
    };

    config = mkIf cfg.enable {
      environment.systemPackages = [ cfg.package ];

      systemd.services.ckb-next = {
        description = "Corsair Keyboards and Mice Daemon";
        wantedBy = ["multi-user.target"];
        serviceConfig = {
          ExecStart = "${cfg.package}/bin/ckb-next-daemon ${optionalString (cfg.gid != null) "--gid=${builtins.toString cfg.gid}"}";
          Restart = "on-failure";
          StandardOutput = "syslog";
        };
      };
    };

    meta = {
      maintainers = with lib.maintainers; [ kierdavis ];
    };
  }


{ stdenv, fetchurl, parted, gtk, glib, intltool, gettext, libuuid
, pkgconfig, gtkmm, libxml2 }:

stdenv.mkDerivation rec {
  name = "gparted-0.19.1";

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

  configureFlags = "--disable-doc";

  buildInputs = [
    parted gtk glib intltool gettext libuuid pkgconfig gtkmm libxml2
  ];

  preFixup = "rm $out/share/icons/hicolor/icon-theme.cache";

  meta = {
    description = "Graphical disk partitioning tool";
    homepage = http://gparted.sourceforge.net;
    license = stdenv.lib.licenses.gpl2;
    platforms = with stdenv.lib.platforms; linux;
  };
}

Update gparted 0.19.1 -> 0.21.0

{ stdenv, fetchurl, parted, gtk, glib, intltool, gettext, libuuid
, pkgconfig, gtkmm, libxml2 }:

stdenv.mkDerivation rec {
  name = "gparted-0.21.0";

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

  configureFlags = "--disable-doc";

  buildInputs = [
    parted gtk glib intltool gettext libuuid pkgconfig gtkmm libxml2
  ];

  preFixup = "rm $out/share/icons/hicolor/icon-theme.cache";

  meta = with stdenv.lib; {
    description = "Graphical disk partitioning tool";
    longDescription = ''
      GNOME Partition Editor for creating, reorganizing, and deleting disk
      partitions. GParted enables you to change the partition organization
      while preserving the partition contents.
    '';
    homepage = http://gparted.sourceforge.net;
    license = with licenses; gpl2Plus;
    platforms = with platforms; linux;
    maintainers = with maintainers; [ nckx ];
  };
}


{ stdenv, gx, gx-go, go, cacert }:

{ name, src, sha256 }:

stdenv.mkDerivation {
  name = "${name}-gxdeps";
  inherit src;

  buildInputs = [ go gx gx-go ];

  outputHashAlgo = "sha256";
  outputHashMode = "recursive";
  outputHash = sha256;

  phases = [ "unpackPhase" "buildPhase" "installPhase" ];

  SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt";

  buildPhase = ''
    export GOPATH=$(pwd)/vendor
    mkdir vendor
    gx install
  '';

  installPhase = ''
    mv vendor $out
  '';

  preferLocalBuild = true;
}

Fix mkdir for fetchgx to not throw an exception

{ stdenv, gx, gx-go, go, cacert }:

{ name, src, sha256 }:

stdenv.mkDerivation {
  name = "${name}-gxdeps";
  inherit src;

  buildInputs = [ go gx gx-go ];

  outputHashAlgo = "sha256";
  outputHashMode = "recursive";
  outputHash = sha256;

  phases = [ "unpackPhase" "buildPhase" "installPhase" ];

  SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt";

  buildPhase = ''
    export GOPATH=$(pwd)/vendor
    mkdir -p vendor
    gx install
  '';

  installPhase = ''
    mv vendor $out
  '';

  preferLocalBuild = true;
}


{ stdenv, fetchurl }:
let
  version = "3.0.2";
  baseName = "siege";
in stdenv.mkDerivation rec {
  name = "${baseName}-${version}";
  src = fetchurl {
    url = "http://www.joedog.org/pub/siege/${name}.tar.gz";
    sha256 = "0b86rvcrjxy6h9w32bhpcm1gwmn223mf9f30dfsnaw51w90kn716";
  };
  NIX_LDFLAGS = stdenv.lib.optionalString stdenv.isLinux "-lgcc_s";
}

Update siege to 3.0.5 and add meta information

{ stdenv, fetchurl, lib }:
let
  version = "3.0.5";
  baseName = "siege";
in stdenv.mkDerivation rec {
  name = "${baseName}-${version}";
  src = fetchurl {
    url = "http://www.joedog.org/pub/siege/${name}.tar.gz";
    sha256 = "16faa6kappg23bdriyiy3ym94rmddpvw8cl8xgv5nxq2v17n4gi8";
  };
  meta = {
    description = "HTTP load tester";
    maintainers = with lib.maintainers; [ ocharles raskin ];
    platforms = with lib.platforms; linux;
    license = with lib.licenses; gpl2Plus;
  };
  NIX_LDFLAGS = stdenv.lib.optionalString stdenv.isLinux "-lgcc_s";
}


{ pkgs, ... }:

{
  programs.fish.enable = true;
  programs.fish.package = pkgs.fish.overrideAttrs (old: {
    patches = old.patches ++ [
      # https://github.com/fish-shell/fish-shell/pull/5637 is merged but not
      # yet released. Need this for sane behavior on macOS.
      (pkgs.fetchpatch {
        url = "https://patch-diff.githubusercontent.com/raw/fish-shell/fish-shell/pull/5637.diff";
        sha256 = "020f18pglsdh3ah28qyvni0986spv2gbha67gbcirzr2xspsfc45";
        excludes = [ "CHANGELOG.md" ];
      })
    ];
  });
  programs.fish.promptInit = builtins.readFile ./fish_prompt.fish;
  xdg.configFile."fish/functions".source = ./functions;
}

Make fish override more flexible

{ pkgs, ... }:

{
  programs.fish.enable = true;
  programs.fish.package = pkgs.fish.overrideAttrs (old: {
    patches = old.patches or [] ++ [
      # https://github.com/fish-shell/fish-shell/pull/5637 is merged but not
      # yet released. Need this for sane behavior on macOS.
      (pkgs.fetchpatch {
        url = "https://patch-diff.githubusercontent.com/raw/fish-shell/fish-shell/pull/5637.diff";
        sha256 = "020f18pglsdh3ah28qyvni0986spv2gbha67gbcirzr2xspsfc45";
        excludes = [ "CHANGELOG.md" ];
      })
    ];
  });
  programs.fish.promptInit = builtins.readFile ./fish_prompt.fish;
  xdg.configFile."fish/functions".source = ./functions;
}