{ stdenv
, cmake
, fetchurl
, ninja

, libsodium
}:

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

  src = fetchurl {
    url = "https://github.com/jedisct1/minisign/archive/${version}.tar.gz";
    sha256 = "f2267a07bece923d4d174ccacccc56eff9c05b28c4d971e601de896355442f09";
  };

  nativeBuildInputs = [
    cmake
    ninja
  ];

  buildInputs = [
    libsodium
  ];

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

Allow updates to verify minisign hash

{ stdenv
, cmake
, fetchurl
, ninja

, libsodium
}:

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

  src = fetchurl {
    url = "https://github.com/jedisct1/minisign/archive/${version}.tar.gz";
    sha256 = "f2267a07bece923d4d174ccacccc56eff9c05b28c4d971e601de896355442f09";
  };

  nativeBuildInputs = [
    cmake
    ninja
  ];

  buildInputs = [
    libsodium
  ];

  passthru = {
    srcUpdate = fetchurl {
      url = "https://github.com/jedisct1/minisign/archive/${version}.tar.gz";
      minisignUrl = "https://github.com/jedisct1/minisign/releases/download/${version}/minisign-${version}.tar.gz.minisig";
      minisignPub = "RWQf6LRCGA9i53mlYecO4IzT51TGPpvWucNSCh1CBM0QTaLn73Y7GFO3";
      sha256 = "f2267a07bece923d4d174ccacccc56eff9c05b28c4d971e601de896355442f0a";
      showURLs = true;
    };
  };

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


{stdenv, fetchurl}:

stdenv.mkDerivation {
  name = "fdupes-1.50-PR2";
  src = fetchurl {
    url = http://fdupes.googlecode.com/files/fdupes-1.50-PR2.tar.gz;
    sha256 = "068nxcn3xilaphq53sywli9ndydy4gijfi2mz7h45kpy0q9cgwjs";
  };

  # workaround: otherwise make install fails (should be fixed in trunk)
  preInstall = "mkdir -p $out/bin $out/man/man1";

  makeFlags = "PREFIX=\${out}";

  meta = {
    description = "Identifies duplicate files residing within specified directories";
    longDescription = ''
      FDUPES uses md5sums and then a byte by byte comparison to finde duplicate
      files within a set of directories.
    '';
    homepage = http://code.google.com/p/fdupes/;
    license = stdenv.lib.licenses.mit;
    platforms = stdenv.lib.platforms.all;
    maintainers = [
      stdenv.lib.maintainers.z77z
    ];
  };
}

Update fdupes to version 1.51

{stdenv, fetchurl}:

stdenv.mkDerivation {
  name = "fdupes-1.51";
  src = fetchurl {
    url = https://github.com/adrianlopezroche/fdupes/archive/fdupes-1.51.tar.gz;
    sha256 = "11j96vxl9vg3jsnxqxskrv3gad6dh7hz2zpyc8n31xzyxka1c7kn";
  };

  # workaround: otherwise make install fails (should be fixed in trunk)
  preInstall = "mkdir -p $out/bin $out/man/man1";

  makeFlags = "PREFIX=\${out}";

  meta = {
    description = "Identifies duplicate files residing within specified directories";
    longDescription = ''
      FDUPES uses md5sums and then a byte by byte comparison to finde duplicate
      files within a set of directories.
    '';
    homepage = http://code.google.com/p/fdupes/;
    license = stdenv.lib.licenses.mit;
    platforms = stdenv.lib.platforms.all;
    maintainers = [
      stdenv.lib.maintainers.z77z
    ];
  };
}


{ config, pkgs, ... }:

let
  dag = config.lib.dag;
  pkg-list-opts = {
    pkgs = pkgs;
    unstable = import (fetchTarball https://nixos.org/channels/nixos-unstable/nixexprs.tar.xz) {};
  };
  base = import ./pkg-lists/base.nix pkg-list-opts;
  active = import ./pkg-lists/active.nix pkg-list-opts;
in
  {
    programs.home-manager.enable = true;
    home.stateVersion = "21.05";
    home.username = "$USER";
    home.homeDirectory = "/home/$USER";

    nixpkgs.config.allowUnfree = true;
    fonts.fontconfig.enable = true;

    home.packages = base ++ active;

    programs.direnv.enable = true;
    programs.direnv.nix-direnv.enable = true;

    home.activation.stow = dag.entryAfter [ "writeBoundary" ] ''
      cd $HOME/.config/nixpkgs
      stow --target=$HOME stowed
    '';

    services.gpg-agent = {
      enable = true;
      defaultCacheTtl = 1800;
      enableSshSupport = true;
      pinentryFlavor = "curses";
    };

    services.dropbox = {
      enable = true;
    };
  }

Remove the dropbox service, it doesn't work

{ config, pkgs, ... }:

let
  dag = config.lib.dag;
  pkg-list-opts = {
    pkgs = pkgs;
    unstable = import (fetchTarball https://nixos.org/channels/nixos-unstable/nixexprs.tar.xz) {};
  };
  base = import ./pkg-lists/base.nix pkg-list-opts;
  active = import ./pkg-lists/active.nix pkg-list-opts;
in
  {
    programs.home-manager.enable = true;
    home.stateVersion = "21.05";
    home.username = "$USER";
    home.homeDirectory = "/home/$USER";

    nixpkgs.config.allowUnfree = true;
    fonts.fontconfig.enable = true;

    home.packages = base ++ active;

    programs.direnv.enable = true;
    programs.direnv.nix-direnv.enable = true;

    home.activation.stow = dag.entryAfter [ "writeBoundary" ] ''
      cd $HOME/.config/nixpkgs
      stow --target=$HOME stowed
    '';

    services.gpg-agent = {
      enable = true;
      defaultCacheTtl = 1800;
      enableSshSupport = true;
      pinentryFlavor = "curses";
    };
  }


{stdenv, fetchurl, ncurses}:

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

  src = fetchurl {
    urls = [
      "http://src.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 ];
  };
}

Fix build after ncurses5 changes

{stdenv, fetchurl, ncurses}:

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

  src = fetchurl {
    urls = [
      "http://src.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 ];

  # Fix build for recent ncurses versions
  NIX_CFLAGS_COMPILE = [ "-DNCURSES_INTERNALS=1" ];

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


{ config, pkgs, ... }:

{
  nixpkgs.config.allowUnfree = true;

  nixpkgs.overlays = [ (import ./nixpkgs-mpcsh) ];

  nix.useSandbox = true;

  system.autoUpgrade = {
    enable = true;
    channel = https://nixos.org/channels/nixos-unstable;
  };

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

Make the auto upgrade happen every 3 hours

{ config, pkgs, ... }:

{
  nixpkgs.config.allowUnfree = true;

  nixpkgs.overlays = [ (import ./nixpkgs-mpcsh) ];

  nix.useSandbox = true;

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

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


# /etc files related to networking, such as /etc/services.

{config, pkgs, ...}:

let

  options = {

    networking.extraHosts = pkgs.lib.mkOption {
      default = "";
      example = "192.168.0.1 lanlocalhost";
      description = ''
        Additional entries to be appended to <filename>/etc/hosts</filename>.
      '';
    };

  };

in

{
  require = [options];

  environment.etc =
    [ { # /etc/services: TCP/UDP port assignments.
        source = pkgs.iana_etc + "/etc/services";
        target = "services";
      }

      { # /etc/protocols: IP protocol numbers.
        source = pkgs.iana_etc + "/etc/protocols";
        target = "protocols";
      }

      { # /etc/rpc: RPC program numbers.
        source = pkgs.glibc + "/etc/rpc";
        target = "rpc";
      }

      { # /etc/hosts: Hostname-to-IP mappings.
        source = pkgs.writeText "hosts"
          ''
            ${config.networking.extraHosts}
            127.0.0.1 localhost
          '';
        target = "hosts";
      }
    ];
}

Add `localhost' under its "real" host name to /etc/hosts.

# /etc files related to networking, such as /etc/services.

{config, pkgs, ...}:

let

  options = {

    networking.extraHosts = pkgs.lib.mkOption {
      default = "";
      example = "192.168.0.1 lanlocalhost";
      description = ''
        Additional entries to be appended to <filename>/etc/hosts</filename>.
      '';
    };

  };

in

{
  require = [options];

  environment.etc =
    [ { # /etc/services: TCP/UDP port assignments.
        source = pkgs.iana_etc + "/etc/services";
        target = "services";
      }

      { # /etc/protocols: IP protocol numbers.
        source = pkgs.iana_etc + "/etc/protocols";
        target = "protocols";
      }

      { # /etc/rpc: RPC program numbers.
        source = pkgs.glibc + "/etc/rpc";
        target = "rpc";
      }

      { # /etc/hosts: Hostname-to-IP mappings.
        source = pkgs.writeText "hosts"
          ''
            ${config.networking.extraHosts}
            ${if config.networking.hostName != ""
              then "127.0.0.1 ${config.networking.hostName}"
              else ""}
            127.0.0.1 localhost
          '';
        target = "hosts";
      }
    ];
}


{ stdenv, fetchurl }:

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

  src = fetchurl {
    url = "http://www.nasm.us/pub/nasm/releasebuilds/${version}/${name}.tar.bz2";
    sha256 = "0v1y1kx09nzmk8w4v79jxhn15fmi3g7l9nmgkn7ldjl1d5yxkdl7";
  };

  meta = {
    homepage = http://www.nasm.us/;
    description = "An 80x86 and x86-64 assembler designed for portability and modularity";
    platforms = stdenv.lib.platforms.unix;
  };
}

Revert "update from 2.11.05 to 2.11.06"

{ stdenv, fetchurl }:

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

  src = fetchurl {
    url = "http://www.nasm.us/pub/nasm/releasebuilds/${version}/${name}.tar.bz2";
    sha256 = "1sgspnascc0asmwlv3jm1mq4vzx653sa7vlg48z20pfybk7pnhaa";
  };

  meta = {
    homepage = http://www.nasm.us/;
    description = "An 80x86 and x86-64 assembler designed for portability and modularity";
    platforms = stdenv.lib.platforms.unix;
  };
}


{ stdenv
, buildPythonPackage
, cython
, fetchFromGitHub
#, fetchPyPi
, lib

, libyaml
}:

let

  version = "2017-09-11";
in
buildPythonPackage {
  name = "PyYAML-${version}";

  # src = fetchPyPi {
  #   package = "PyYAML";
  #   inherit version;
  #   sha256 = "592766c6303207a20efc445587778322d7f73b161bd994f227adaa341ba212ab";
  # };

  # Temporary until >3.12 is released, needed for python 3.7 compatibility.
  src = fetchFromGitHub {
    version = 5;
    owner = "yaml";
    repo = "pyyaml";
    rev = "298e07907ae526594069f6fdf31f2f1278cc1ae3";
    sha256 = "39eb24b73f96c9ed5b082f9179019e5a117187bd15b0025f71eab8ffba3b54e8";
  };

  nativeBuildInputs = [
    cython
  ];

  buildInputs = [
    libyaml
  ];

  meta = with lib; {
    maintainers = with maintainers; [
      wkennington
    ];
    platforms = with platforms;
      x86_64-linux;
  };
}

Revert "pyyaml: 3.12 -> 2017-09-11"

{ stdenv
, buildPythonPackage
, fetchPyPi

, libyaml
}:

let
  version = "3.12";
in
buildPythonPackage {
  name = "PyYAML-${version}";

  src = fetchPyPi {
    package = "PyYAML";
    inherit version;
    sha256 = "592766c6303207a20efc445587778322d7f73b161bd994f227adaa341ba212ab";
  };

  nativeBuildInputs = [
    cython
  ];

  buildInputs = [
    libyaml
  ];

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


{ stdenv, fetchgit, cmake, boehmgc, expat, cppunit }:

stdenv.mkDerivation {
  name = "boomerang-1.0pre";

  buildInputs = [ cmake boehmgc expat cppunit ];

  installPhase = ''
    for loaderfile in loader/*.so
    do
      install -vD "$loaderfile" "$out/lib/$(basename "$loaderfile")"
    done

    install -vD boomerang "$out/bin/boomerang"
  '';

  src = fetchgit {
    url = "git://github.com/andrew-aladev/boomerang.git";
    rev = "c0ad5c1f64091725b4ca7f63c57edd3d3bc74a57";
    sha256 = "76d8512db672bad1322943172046e4b450c5fa509e4141457b3dc60493852fcc";
  };

  meta = {
    homepage = http://boomerang.sourceforge.net/;
    license = stdenv.lib.licenses.bsd3;
    description = "A general, open source, retargetable decompiler";
  };
}

Fix endless loop in createDirectory().

{ stdenv, fetchgit, cmake, boehmgc, expat, cppunit }:

stdenv.mkDerivation {
  name = "boomerang-1.0pre";

  buildInputs = [ cmake boehmgc expat cppunit ];

  installPhase = ''
    for loaderfile in loader/*.so
    do
      install -vD "$loaderfile" "$out/lib/$(basename "$loaderfile")"
    done

    install -vD boomerang "$out/bin/boomerang"
  '';

  src = fetchgit {
    url = "git://github.com/aszlig/boomerang.git";
    rev = "d0b147a5dfc915a5fa8fe6c517e66a049a37bf22";
    sha256 = "6cfd95a3539ff45c18b17de76407568b0d0c17fde4e45dda54486c7eac113969";
  };

  meta = {
    homepage = http://boomerang.sourceforge.net/;
    license = stdenv.lib.licenses.bsd3;
    description = "A general, open source, retargetable decompiler";
  };
}


{ stdenv, fetchurl, nasm, perl }:

stdenv.mkDerivation rec {
  name = "syslinux-4.03";

  src = fetchurl {
    url = "mirror://kernel/linux/utils/boot/syslinux/4.xx/${name}.tar.bz2";
    sha256 = "0f6s1cnibw6j0jh9bn5qsx3vsar9l1w9b3xfjkvzglgr4kinfmf6";
  };

  patches = [ ./perl-deps.patch ];

  buildInputs = [ nasm perl ];

  preBuild =
    ''
      substituteInPlace gpxe/src/Makefile.housekeeping --replace /bin/echo $(type -P echo)
      substituteInPlace gpxe/src/Makefile --replace /usr/bin/perl $(type -P perl)
      makeFlagsArray=(BINDIR=$out/bin SBINDIR=$out/sbin LIBDIR=$out/lib INCDIR=$out/include DATADIR=$out/share MANDIR=$out/share/man PERL=perl)
    '';
}

Update to 4.06 and fix build

{ stdenv, fetchurl, nasm, perl, libuuid }:

stdenv.mkDerivation rec {
  name = "syslinux-4.06";

  src = fetchurl {
    url = "mirror://kernel/linux/utils/boot/syslinux/4.xx/${name}.tar.bz2";
    sha256 = "09md61npd5z64rv5s3knl4qsn2bqsn57irm5izk6snf46r77gdyv";
  };

  patches = [ ./perl-deps.patch ];

  buildInputs = [ nasm perl libuuid ];

  enableParallelBuilding = true;

  preBuild =
    ''
      substituteInPlace gpxe/src/Makefile.housekeeping --replace /bin/echo $(type -P echo)
      substituteInPlace gpxe/src/Makefile --replace /usr/bin/perl $(type -P perl)
      makeFlagsArray=(BINDIR=$out/bin SBINDIR=$out/sbin LIBDIR=$out/lib INCDIR=$out/include DATADIR=$out/share MANDIR=$out/share/man PERL=perl)
    '';

  meta = {
    homepage = http://www.syslinux.org/;
    description = "A lightweight bootloader";
  };
}


{ stdenv, fetchFromGitHub, automake, autoconf, libtool, gtk-doc
, pkgconfig, glib, systemd, libgudev, vala }:

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

  src = fetchFromGitHub {
    owner = "martinpitt";
    repo = "umockdev";
    rev = version;
    sha256 ="1gpk2f03nad4qv084hx7549d68cqc1xibxm0ncanafm5xjz1hp55";
  };

  buildInputs = [ glib systemd libgudev ];
  nativeBuildInputs = [ automake autoconf libtool gtk-doc pkgconfig vala ];

  preConfigure = "NOCONFIGURE=1 ./autogen.sh";

  meta = with stdenv.lib; {
    description = "Mock hardware devices for creating unit tests";
    license = licenses.lgpl2;
    maintainers = [ maintainers.ndowens ];
  };
}

Add platforms attribute to umockdev

{ stdenv, fetchFromGitHub, automake, autoconf, libtool, gtk-doc
, pkgconfig, glib, systemd, libgudev, vala }:

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

  src = fetchFromGitHub {
    owner = "martinpitt";
    repo = "umockdev";
    rev = version;
    sha256 ="1gpk2f03nad4qv084hx7549d68cqc1xibxm0ncanafm5xjz1hp55";
  };

  buildInputs = [ glib systemd libgudev ];
  nativeBuildInputs = [ automake autoconf libtool gtk-doc pkgconfig vala ];

  preConfigure = "NOCONFIGURE=1 ./autogen.sh";

  meta = with stdenv.lib; {
    description = "Mock hardware devices for creating unit tests";
    license = licenses.lgpl2;
    maintainers = [ maintainers.ndowens ];
    platforms = with platforms; linux;
  };
}


{ stdenv, fetchurl }:

stdenv.mkDerivation rec {
  name = "tmpwatch-2.11";

  src = fetchurl {
    url = "https://fedorahosted.org/releases/t/m/tmpwatch/tmpwatch-2.11.tar.bz2";
    sha256 = "1m5859ngwx61l1i4s6fja2avf1hyv6w170by273w8nsin89825lk";
  };

  meta = {
    homepage = https://fedorahosted.org/tmpwatch/;
    description = "The tmpwatch utility recursively searches through specified directories and removes files which have not been accessed in a specified period of time.";
    licence = "GPLv2";
    maintainers = with stdenv.lib.maintainers; [ vlstill ];
  };
}

Add platforms to meta (unix).

{ stdenv, fetchurl }:

stdenv.mkDerivation rec {
  name = "tmpwatch-2.11";

  src = fetchurl {
    url = "https://fedorahosted.org/releases/t/m/tmpwatch/tmpwatch-2.11.tar.bz2";
    sha256 = "1m5859ngwx61l1i4s6fja2avf1hyv6w170by273w8nsin89825lk";
  };

  meta = {
    homepage = https://fedorahosted.org/tmpwatch/;
    description = "The tmpwatch utility recursively searches through specified directories and removes files which have not been accessed in a specified period of time.";
    licence = "GPLv2";
    maintainers = with stdenv.lib.maintainers; [ vlstill ];
    platforms = stdenv.lib.platforms.unix;
  };
}


{ stdenv, lib, fetchgit, pkg-config, meson, ninja
, enchant, gtkmm3, libchamplain, libgcrypt, shared-mime-info }:

stdenv.mkDerivation rec {
  pname = "lifeograph";
  version = "2.0.3";

  src = fetchgit {
    url = "https://git.launchpad.net/lifeograph";
    rev = "v${version}";
    sha256 = "sha256-RotbTdTtpwXmo+UKOyp93IAC6CCstv++KtnX2doN+nM=";
  };

  nativeBuildInputs = [
    meson
    ninja
    pkg-config
    shared-mime-info # for update-mime-database
  ];

  buildInputs = [
    libgcrypt
    enchant
    gtkmm3
    libchamplain
  ];

  postInstall = ''
    substituteInPlace $out/share/applications/net.sourceforge.Lifeograph.desktop \
      --replace "Exec=" "Exec=$out/bin/"
  '';

  meta = with lib; {
    homepage = "http://lifeograph.sourceforge.net/wiki/Main_Page";
    description = "Lifeograph is an off-line and private journal and note taking application";
    license = licenses.gpl3Only;
    maintainers = with maintainers; [ wolfangaukang ];
    platforms = platforms.linux;
  };
}

Add wrapGAppsHook to lifeograph to fix issue with being unable to decrypt diaries when launched from dmenu

{ stdenv, lib, fetchgit, pkg-config, meson, ninja, wrapGAppsHook
, enchant, gtkmm3, libchamplain, libgcrypt, shared-mime-info }:

stdenv.mkDerivation rec {
  pname = "lifeograph";
  version = "2.0.3";

  src = fetchgit {
    url = "https://git.launchpad.net/lifeograph";
    rev = "v${version}";
    sha256 = "sha256-RotbTdTtpwXmo+UKOyp93IAC6CCstv++KtnX2doN+nM=";
  };

  nativeBuildInputs = [
    meson
    ninja
    pkg-config
    shared-mime-info # for update-mime-database
    wrapGAppsHook
  ];

  buildInputs = [
    libgcrypt
    enchant
    gtkmm3
    libchamplain
  ];

  postInstall = ''
    substituteInPlace $out/share/applications/net.sourceforge.Lifeograph.desktop \
      --replace "Exec=" "Exec=$out/bin/"
  '';

  meta = with lib; {
    homepage = "http://lifeograph.sourceforge.net/wiki/Main_Page";
    description = "Lifeograph is an off-line and private journal and note taking application";
    license = licenses.gpl3Only;
    maintainers = with maintainers; [ wolfangaukang ];
    platforms = platforms.linux;
  };
}


{ stdenv, pythonPackages, fetchFromGitHub }:

pythonPackages.buildPythonApplication rec {
  pname = "ntfy";
  version = "2.7.0";

  src = fetchFromGitHub {
    owner = "dschep";
    repo = "ntfy";
    rev = "v${version}";
    sha256 = "09f02cn4i1l2aksb3azwfb70axqhn7d0d0vl2r6640hqr74nc1cv";
  };

  checkInputs = with pythonPackages; [
    mock
  ];

  propagatedBuildInputs = with pythonPackages; [
    requests ruamel_yaml appdirs
    sleekxmpp dns
    emoji
    psutil
    matrix-client
    dbus-python
  ];

  checkPhase = ''
    HOME=$(mktemp -d) ${pythonPackages.python.interpreter} setup.py test
  '';

  meta = with stdenv.lib; {
    description = "A utility for sending notifications, on demand and when commands finish";
    homepage = "http://ntfy.rtfd.org/";
    license = licenses.gpl3;
    maintainers = with maintainers; [ jfrankenau kamilchm ];
  };
}

Switch to python3. Also fixes test failure.

{ stdenv, python3Packages, fetchFromGitHub }:

python3Packages.buildPythonApplication rec {
  pname = "ntfy";
  version = "2.7.0";

  src = fetchFromGitHub {
    owner = "dschep";
    repo = "ntfy";
    rev = "v${version}";
    sha256 = "09f02cn4i1l2aksb3azwfb70axqhn7d0d0vl2r6640hqr74nc1cv";
  };

  checkInputs = with python3Packages; [
    mock
  ];

  propagatedBuildInputs = with python3Packages; [
    requests ruamel_yaml appdirs
    sleekxmpp dns
    emoji
    psutil
    matrix-client
    dbus-python
  ];

  checkPhase = ''
    HOME=$(mktemp -d) ${python3Packages.python.interpreter} setup.py test
  '';

  meta = with stdenv.lib; {
    description = "A utility for sending notifications, on demand and when commands finish";
    homepage = "http://ntfy.rtfd.org/";
    license = licenses.gpl3;
    maintainers = with maintainers; [ jfrankenau kamilchm ];
  };
}


{disnix, dysnomia}:
{config, pkgs, ...}:

{
  virtualisation.writableStore = true;
  virtualisation.pathsInNixDB = [ pkgs.stdenv ];

  ids.gids = { disnix = 200; };
  users.extraGroups = [ { gid = 200; name = "disnix"; } ];

  users.extraUsers = [
    { uid = 1000;
      name = "unprivileged";
      group = "users";
      shell = "/bin/sh";
      description = "Unprivileged user for the disnix-service";
    }

    { uid = 1001;
      name = "privileged";
      group = "users";
      shell = "/bin/sh";
      extraGroups = [ "disnix" ];
      description = "Privileged user for the disnix-service";
    }
  ];

  services.dbus.enable = true;
  services.dbus.packages = [ disnix ];
  services.openssh.enable = true;

  jobs.disnix =
    { description = "Disnix server";
      wantedBy = [ "multi-user.target" ];
      after = [ "dbus.service" ];

      path = [ pkgs.nix pkgs.getopt disnix dysnomia ];
      environment = {
        HOME = "/root";
      };

      exec = "disnix-service";
    };

    environment.systemPackages = [ disnix dysnomia ];
}

Convert jobs definition to the new systemd convention

{disnix, dysnomia}:
{config, pkgs, ...}:

{
  virtualisation.writableStore = true;
  virtualisation.pathsInNixDB = [ pkgs.stdenv ];

  ids.gids = { disnix = 200; };
  users.extraGroups = [ { gid = 200; name = "disnix"; } ];

  users.extraUsers = [
    { uid = 1000;
      name = "unprivileged";
      group = "users";
      shell = "/bin/sh";
      description = "Unprivileged user for the disnix-service";
    }

    { uid = 1001;
      name = "privileged";
      group = "users";
      shell = "/bin/sh";
      extraGroups = [ "disnix" ];
      description = "Privileged user for the disnix-service";
    }
  ];

  services.dbus.enable = true;
  services.dbus.packages = [ disnix ];
  services.openssh.enable = true;

  systemd.services.disnix =
    { description = "Disnix server";
      wantedBy = [ "multi-user.target" ];
      after = [ "dbus.service" ];

      path = [ pkgs.nix pkgs.getopt disnix dysnomia ];
      environment = {
        HOME = "/root";
      };

      serviceConfig.ExecStart = "${disnix}/bin/disnix-service";
    };

    environment.systemPackages = [ disnix dysnomia ];
}


# Shiro -- my laptop

{ pkgs, ... }:
{
  imports = [
    ../personal.nix   # common settings
    ./hardware-configuration.nix
    ## Dekstop environment
    <modules/desktop/bspwm.nix>
    ## Apps
    <modules/browser/firefox.nix>
    <modules/dev>
    <modules/editors/emacs.nix>
    <modules/editors/vim.nix>
    <modules/shell/direnv.nix>
    <modules/shell/git.nix>
    <modules/shell/gnupg.nix>
    <modules/shell/pass.nix>
    <modules/shell/zsh.nix>
    ## Project-based
    <modules/chat.nix>       # discord, mainly
    <modules/recording.nix>  # recording video & audio
    <modules/daw.nix>        # making music
    <modules/music.nix>      # playing music
    <modules/graphics.nix>   # art & design
    # <modules/vm.nix>         # virtualbox for testing
    ## Services
    <modules/services/syncthing.nix>
    ## Theme
    <modules/themes/aquanaut>
  ];

  networking.wireless.enable = true;
  hardware.opengl.enable = true;

  time.timeZone = "America/Toronto";
  # time.timeZone = "Europe/Copenhagen";

  # Optimize power use
  environment.systemPackages = [ pkgs.acpi ];
  powerManagement.powertop.enable = true;
  # Monitor backlight control
  programs.light.enable = true;
}

Add tmux module to shiro

# Shiro -- my laptop

{ pkgs, ... }:
{
  imports = [
    ../personal.nix   # common settings
    ./hardware-configuration.nix
    ## Dekstop environment
    <modules/desktop/bspwm.nix>
    ## Apps
    <modules/browser/firefox.nix>
    <modules/dev>
    <modules/editors/emacs.nix>
    <modules/editors/vim.nix>
    <modules/shell/direnv.nix>
    <modules/shell/git.nix>
    <modules/shell/gnupg.nix>
    <modules/shell/pass.nix>
    <modules/shell/tmux.nix>
    <modules/shell/zsh.nix>
    ## Project-based
    <modules/chat.nix>       # discord, mainly
    <modules/recording.nix>  # recording video & audio
    <modules/daw.nix>        # making music
    <modules/music.nix>      # playing music
    <modules/graphics.nix>   # art & design
    # <modules/vm.nix>         # virtualbox for testing
    ## Services
    <modules/services/syncthing.nix>
    ## Theme
    <modules/themes/aquanaut>
  ];

  networking.wireless.enable = true;
  hardware.opengl.enable = true;

  time.timeZone = "America/Toronto";
  # time.timeZone = "Europe/Copenhagen";

  # Optimize power use
  environment.systemPackages = [ pkgs.acpi ];
  powerManagement.powertop.enable = true;
  # Monitor backlight control
  programs.light.enable = true;
}


with (import <nixpkgs> {});
{ inherit
     ag
     pstree
     tree
     vim
     wget
     ;
}

Add awscli and thefuck packages

with (import <nixpkgs> {});
{ inherit
     ag
     awscli
     pstree
     thefuck
     tree
     vim
     wget
     ;
}


{ config, pkgs, ... }:

{
  services.xserver = {
    enable = true;
    layout = "us";

    displayManager.slim = {
      enable = true;
      autoLogin = true;
      defaultUser = "kiba";
    };

    desktopManager = {
      # Disable the defaults.  Don't use a desktop manager or xterm.
      default = "none";
      xterm.enable = false;
    };

    windowManager = {
      default = "spectrwm";
      spectrwm.enable = true;
    };
  };

  # Fonts to include
  fonts.fonts = [
    pkgs.corefonts # Microsoft free fonts
    pkgs.source-code-pro
    pkgs.source-sans-pro
    pkgs.source-serif-pro
  ];

  # Default fonts
  fonts.fontconfig.defaultFonts = {
    monospace = [ "Source Code Pro" ];
    sansSerif = [ "Source Sans Pro" ];
    serif = [ "Source Serif Pro" ];
  };

  environment.systemPackages = [
    # Browsers
    pkgs.chromium
    pkgs.firefox

    # Terminal
    pkgs.st

    # Menu
    pkgs.dmenu

    # Clipboard
    pkgs.xsel

    # Graphical lock
    pkgs.i3lock
  ];
}

Add tools for taking screenshots and viewing images

{ config, pkgs, ... }:

{
  services.xserver = {
    enable = true;
    layout = "us";

    displayManager.slim = {
      enable = true;
      autoLogin = true;
      defaultUser = "kiba";
    };

    desktopManager = {
      # Disable the defaults.  Don't use a desktop manager or xterm.
      default = "none";
      xterm.enable = false;
    };

    windowManager = {
      default = "spectrwm";
      spectrwm.enable = true;
    };
  };

  # Fonts to include
  fonts.fonts = [
    pkgs.corefonts # Microsoft free fonts
    pkgs.source-code-pro
    pkgs.source-sans-pro
    pkgs.source-serif-pro
  ];

  # Default fonts
  fonts.fontconfig.defaultFonts = {
    monospace = [ "Source Code Pro" ];
    sansSerif = [ "Source Sans Pro" ];
    serif = [ "Source Serif Pro" ];
  };

  environment.systemPackages = [
    # Browsers
    pkgs.chromium
    pkgs.firefox

    # Terminal
    pkgs.st

    # Menu
    pkgs.dmenu

    # Clipboard
    pkgs.xsel

    # Fake keyboard/mouse input, window management, and more
    pkgs.xdotool

    # Graphical lock
    pkgs.i3lock

    # Screenshot tool
    pkgs.maim

    # Image viewer
    pkgs.sxiv
  ];
}


{ stdenv, fetchurl, pkgconfig, openssl, libxslt, perl
, curl, pcre, libxml2, librdf_rasqal, librdf_raptor
, mysql ? null, postgresql ? null, sqlite ? null, bdb ? null
}:

stdenv.mkDerivation rec {
  name = "redland-1.0.10";

  src = fetchurl {
    url = "mirror://sf/librdf/${name}.tar.gz";
    sha256 = "05cq722qvw5sq08qbydzjv5snqk402cbdsy8s6qjzir7vq2hs1p3";
  };

  buildInputs = [ pkgconfig ];

  propagatedBuildInputs = [
    bdb openssl libxslt perl mysql postgresql sqlite curl pcre libxml2
    librdf_raptor librdf_rasqal
  ];

  configureFlags =
    [ "--with-threads" ]
    ++ stdenv.lib.optional (bdb != null) "--with-bdb=${bdb}";

  patchPhase ="sed -e 1s@/usr@${perl}@ -i utils/touch-mtime.pl";
}

Fix a redland linking problem

{ stdenv, fetchurl, pkgconfig, openssl, libxslt, perl
, curl, pcre, libxml2, librdf_rasqal, librdf_raptor
, mysql ? null, postgresql ? null, sqlite ? null, bdb ? null
}:

stdenv.mkDerivation rec {
  name = "redland-1.0.10";

  src = fetchurl {
    url = "mirror://sf/librdf/${name}.tar.gz";
    sha256 = "05cq722qvw5sq08qbydzjv5snqk402cbdsy8s6qjzir7vq2hs1p3";
  };

  buildInputs = [ pkgconfig ];

  propagatedBuildInputs = [
    bdb openssl libxslt perl mysql postgresql sqlite curl pcre libxml2
    librdf_raptor librdf_rasqal
  ];

  preConfigure = ''
    export NIX_LDFLAGS="$NIX_LDFLAGS -lrasqal -lraptor"
  '';

  configureFlags =
    [ "--with-threads" ]
    ++ stdenv.lib.optional (bdb != null) "--with-bdb=${bdb}";

  patchPhase ="sed -e 1s@/usr@${perl}@ -i utils/touch-mtime.pl";
}


{
  packageOverrides = pkgs: with pkgs; {
    myPackages = pkgs.buildEnv {
      name = "my-packages";
      paths = [
        ag
        appimage-run
        augeas
        (autojump.overrideAttrs (attrs: {
          meta.priority = 3;
        }))
        aws
        bridge-utils
        cloc
        curl
        dnsmasq
        docker
        docker-compose
        file
        fontconfig
        fuse
        fzf
        git
        git-lfs
        gnused
        go
        gptfdisk
        gnugrep
        grml-zsh-config
        homesick
        htop
        inetutils
        less
        lxc
        lxd
        man
        man-pages
        ncurses5
        nodejs-11_x
        open-sans
        openbox
        openconnect
        openssh
        papirus-icon-theme
        python
        python27Packages.supervisor
        python3
        qemu
        rclone
        rclone-browser
        readline70
        ripgrep
        rmlint
        (ruby_2_6.overrideAttrs (attrs: {
          meta.priority = 3;
        }))
        s3cmd
        shellcheck
        socat
        sqlite
        terraform
        tig
        tigervnc
        tmux
        tree
        unzip
        vagrant
        (vimHugeX.overrideAttrs (attrs: {
          meta.priority = 3;
        }))
        wget
        xorg.xset
        zip
        zsh
        zsh-autosuggestions
        zsh-syntax-highlighting
      ];
    };
  };
}

Allow unfree packages in Nix

{
  allowUnfree = true;
  packageOverrides = pkgs: with pkgs; {
    myPackages = pkgs.buildEnv {
      name = "my-packages";
      paths = [
        ag
        appimage-run
        augeas
        (autojump.overrideAttrs (attrs: {
          meta.priority = 3;
        }))
        aws
        bridge-utils
        cloc
        curl
        dnsmasq
        docker
        docker-compose
        file
        fontconfig
        fuse
        fzf
        git
        git-lfs
        gnused
        go
        gptfdisk
        gnugrep
        grml-zsh-config
        homesick
        htop
        inetutils
        less
        lxc
        lxd
        man
        man-pages
        ncurses5
        nodejs-11_x
        open-sans
        openbox
        openconnect
        openssh
        papirus-icon-theme
        python
        python27Packages.supervisor
        python3
        qemu
        rclone
        rclone-browser
        readline70
        ripgrep
        rmlint
        (ruby_2_6.overrideAttrs (attrs: {
          meta.priority = 3;
        }))
        s3cmd
        shellcheck
        socat
        sqlite
        terraform
        tig
        tigervnc
        tmux
        tree
        unzip
        vagrant
        (vimHugeX.overrideAttrs (attrs: {
          meta.priority = 3;
        }))
        wget
        xorg.xset
        zip
        zsh
        zsh-autosuggestions
        zsh-syntax-highlighting
      ];
    };
  };
}


# This module defines the software packages included in the "minimal"
# installation CD.  It might be useful elsewhere.

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

{
  # Include some utilities that are useful for installing or repairing
  # the system.
  environment.systemPackages = [
    pkgs.ms-sys # for writing Microsoft boot sectors / MBRs
    pkgs.efibootmgr
    pkgs.efivar
    pkgs.gptfdisk
    pkgs.ddrescue
    pkgs.openssl
    pkgs.cryptsetup # needed for dm-crypt volumes

    # Hardware-related tools.
    pkgs.sdparm
    pkgs.hdparm
    pkgs.mdadm
    pkgs.smartmontools # for diagnosing hard disks
    pkgs.pciutils
    pkgs.usbutils

    # Tools to create / manipulate filesystems.
    pkgs.ntfs-3g # for resizing NTFS partitions
    pkgs.dosfstools
    pkgs.xfsprogs
    pkgs.f2fs-tools

    # Tools for building
    pkgs.stdenv
    pkgs.git
    pkgs.mg
    pkgs.nano
    pkgs.vim
  ];

  # Include support for various filesystems.
  boot.supportedFilesystems = [ "btrfs" "vfat" "f2fs" "xfs" "zfs" "ntfs" ];

  # Configure host id for ZFS to work
  networking.hostId = lib.mkDefault "8425e349";
}

Add more misc tools to the iso

# This module defines the software packages included in the "minimal"
# installation CD.  It might be useful elsewhere.

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

{
  # Include some utilities that are useful for installing or repairing
  # the system.
  environment.systemPackages = [
    pkgs.ms-sys # for writing Microsoft boot sectors / MBRs
    pkgs.efibootmgr
    pkgs.efivar
    pkgs.gptfdisk
    pkgs.ddrescue
    pkgs.cryptsetup # needed for dm-crypt volumes

    # Hardware-related tools.
    pkgs.sdparm
    pkgs.hdparm
    pkgs.mdadm
    pkgs.smartmontools # for diagnosing hard disks
    pkgs.pciutils
    pkgs.usbutils

    # Tools to create / manipulate filesystems.
    pkgs.ntfs-3g # for resizing NTFS partitions
    pkgs.dosfstools
    pkgs.xfsprogs
    pkgs.f2fs-tools

    # Tools for building
    pkgs.stdenv
    pkgs.git
    pkgs.mg
    pkgs.nano
    pkgs.vim

    # Misc tools
    config.programs.ssh.package
    pkgs.dnsutils
    pkgs.htop
    pkgs.iftop
    pkgs.iotop
    pkgs.mtr
    pkgs.nmap
    pkgs.openssl
    pkgs.gnupg
    pkgs.tmux
    pkgs.screen
  ];

  # Include support for various filesystems.
  boot.supportedFilesystems = [ "btrfs" "vfat" "f2fs" "xfs" "zfs" "ntfs" ];

  # Configure host id for ZFS to work
  networking.hostId = lib.mkDefault "8425e349";
}


{ stdenv, fetchurl }:

stdenv.mkDerivation rec {
  name = "libfaketime-0.9.6";

  src = fetchurl {
    url = "http://www.code-wizards.com/projects/libfaketime/${name}.tar.gz";
    sha256 = "1dw2lqsv2iqwxg51mdn25b4fjj3v357s0mc6ahxawqp210krg29s";
  };

  preBuild = ''
    makeFlagsArray+=(PREFIX="$out" LIBDIRNAME=/lib)
  '';

  meta = with stdenv.lib; {
    description = "Report faked system time to programs without having to change the system-wide time";
    homepage = http://www.code-wizards.com/projects/libfaketime/;
    license = licenses.gpl2;
    platforms = platforms.all;
    maintainers = [ maintainers.bjornfor ];
  };
}

Fix build on gcc 6

{ stdenv, fetchurl }:

stdenv.mkDerivation rec {
  name = "libfaketime-0.9.6";

  src = fetchurl {
    url = "http://www.code-wizards.com/projects/libfaketime/${name}.tar.gz";
    sha256 = "1dw2lqsv2iqwxg51mdn25b4fjj3v357s0mc6ahxawqp210krg29s";
  };

  preBuild = ''
    makeFlagsArray+=(PREFIX="$out" LIBDIRNAME=/lib)
  '';

  # Work around "libfaketime.c:513:7: error: nonnull argument 'buf' compared to NULL [-Werror=nonnull-compare]".
  NIX_CFLAGS_COMPILE = "-Wno-nonnull-compare";

  meta = with stdenv.lib; {
    description = "Report faked system time to programs without having to change the system-wide time";
    homepage = http://www.code-wizards.com/projects/libfaketime/;
    license = licenses.gpl2;
    platforms = platforms.all;
    maintainers = [ maintainers.bjornfor ];
  };
}


{ stdenv, fetchurl, ghostscript, texinfo, imagemagick, texi2html, guile
, python, gettext, flex, perl, bison, pkgconfig, texLive
, fontconfig, freetype, pango, fontforge, help2man }:

stdenv.mkDerivation {
  name = "lilypond-2.13.9";

  src = fetchurl {
    url = http://download.linuxaudio.org/lilypond/sources/v2.13/lilypond-2.13.9.tar.gz;
    sha256 = "1x3jz0zbhly4rc07nry3ia3ydd6vislz81gg0ivwfm6f6q0ssk57";
  };

  configureFlags = [ "--disable-documentation" "--with-ncsb-dir=${ghostscript}/share/ghostscript/fonts"];

  buildInputs =
    [ ghostscript texinfo imagemagick texi2html guile
      python gettext flex perl bison pkgconfig texLive fontconfig freetype pango
      fontforge help2man
    ];

  meta = {
    description = "Music typesetting system";
    homepage = http://lilypond.org/;
    license = "GPL";
    maintainers = [ stdenv.lib.maintainers.marcweber ];
    platforms = stdenv.lib.platforms.linux;
  };

  patches = [ ./findlib.patch ];
}

Update Lilypond - this also fixes its build

{ stdenv, fetchurl, ghostscript, texinfo, imagemagick, texi2html, guile
, python, gettext, flex, perl, bison, pkgconfig, texLive
, fontconfig, freetype, pango, fontforge, help2man }:

stdenv.mkDerivation rec{
  majorVersion="2.13";
  minorVersion="46";
  version="${majorVersion}.${minorVersion}";
  name = "lilypond-${version}";

  src = fetchurl {
    url = "http://download.linuxaudio.org/lilypond/sources/v${majorVersion}/lilypond-${version}.tar.gz";
    sha256 = "370f59d10a3fc74c5790111f7a69e04304eda5384513c95838dda3cc087904e6";
  };

  configureFlags = [ "--disable-documentation" "--with-ncsb-dir=${ghostscript}/share/ghostscript/fonts"];

  buildInputs =
    [ ghostscript texinfo imagemagick texi2html guile
      python gettext flex perl bison pkgconfig texLive fontconfig freetype pango
      fontforge help2man
    ];

  meta = {
    description = "Music typesetting system";
    homepage = http://lilypond.org/;
    license = "GPL";
    maintainers = [ stdenv.lib.maintainers.marcweber ];
    platforms = stdenv.lib.platforms.linux;
  };

  patches = [ ./findlib.patch ];
}


{ pkgs }:

let

  inherit (builtins)
    attrNames fromJSON head readFile ;

  packages = fromJSON (readFile ./main.json);
  package = head packages;

  name = head (attrNames package);
  version = package.${name};

  main =
    let m = (import ./main.nix {
      inherit pkgs;
      inherit (pkgs) nodejs;
      inherit (pkgs.stdenv) system;
    });
    in m // {
      "${name}-${version}" = m."${name}-${version}".override (super: {
        # XXX: build bundled libsassl, DO NOT DOWNLOAD binaries!
        preRebuild = ''
          SASS_FORCE_BUILD=true npm run-script build
        '';
      });
    };

in
pkgs.runCommand "nodejs-sass-${version}" {}
''
  mkdir -p $out/bin
  ln -s ${main."${name}-${version}"}/lib/node_modules/node-sass/bin/node-sass \
    $out/bin/node-sass
  test -x $out/bin/node-sass
''

Stop gyp downloading nodejs headers

{ pkgs }:

let

  inherit (builtins)
    attrNames fromJSON head readFile ;

  packages = fromJSON (readFile ./main.json);
  package = head packages;

  name = head (attrNames package);
  version = package.${name};

  main =
    let m = (import ./main.nix {
      inherit pkgs;
      inherit (pkgs) nodejs;
      inherit (pkgs.stdenv) system;
    });
    in m // {
      "${name}-${version}" = m."${name}-${version}".override (super: {
        # XXX: build bundled libsassl, DO NOT DOWNLOAD binaries!
        # XXX --nodedir is to prevent gyp from downloading nodejs headers
        # XXX: ref. https://github.com/nodejs/node-gyp/issues/1133
        preRebuild = ''
          npm run build --nodedir=${pkgs.nodejs}
        '';
      });
    };

in
pkgs.runCommand "nodejs-sass-${version}" {}
''
  mkdir -p $out/bin
  ln -s ${main."${name}-${version}"}/lib/node_modules/node-sass/bin/node-sass \
    $out/bin/node-sass
  test -x $out/bin/node-sass
''


# vim: et:sw=2:sts=2

{ stdenv, callPackage, haskellPackages, tzdata, harmonicsType ? "free" }:

let
  tcd       = callPackage ./libtcd.nix    {};
  harmonics = callPackage ./harmonics.nix { type = harmonicsType; };
  xtide     = callPackage ./xtide.nix     {};

  inherit (stdenv.lib) concatStringsSep;
in
  with haskellPackages;

  mkDerivation rec {
    pname = "Tides";
    version = "0.1.0.0";
    src = ./.;
    isLibrary = true;
    isExecutable = true;
    libraryHaskellDepends = [ base ];
    executableHaskellDepends = [ base HSH random time time-locale-compat tz QuickCheck ];
    executableSystemDepends = [ tcd ];
    testHaskellDepends = [ base process ];
    configureFlags = [
      "--ghc-option=-DDEFAULT_TIDE_DB_PATH=\"${harmonics}/share/xtide\""
    ];
    shellHook = ''
      configure() {
        cabal configure --enable-tests '${concatStringsSep "' '" configureFlags}' "$@"
      }
      export HFILE_PATH=${harmonics}/share/xtide
      export PATH=${xtide}/bin:$PATH
    '';
    preCheck = "export TZDIR=${tzdata}/share/zoneinfo";
    description = "A program for exploring tidal prediction data";
    license = stdenv.lib.licenses.mit;
  }

Disable shared libraries in nix until test problems are solved

# vim: et:sw=2:sts=2

{ stdenv, callPackage, haskellPackages, tzdata, harmonicsType ? "free" }:

let
  tcd       = callPackage ./libtcd.nix    {};
  harmonics = callPackage ./harmonics.nix { type = harmonicsType; };
  xtide     = callPackage ./xtide.nix     {};

  inherit (stdenv.lib) concatStringsSep;
in
  with haskellPackages;

  mkDerivation rec {
    pname = "Tides";
    version = "0.1.0.0";
    src = ./.;
    isLibrary = true;
    isExecutable = true;
    libraryHaskellDepends = [ base ];
    executableHaskellDepends = [ base HSH random time time-locale-compat tz QuickCheck ];
    executableSystemDepends = [ tcd ];
    testHaskellDepends = [ base process ];
    enableSharedExecutables = false;
    enableSharedLibraries = false;
    configureFlags = [
      "--ghc-option=-DDEFAULT_TIDE_DB_PATH=\"${harmonics}/share/xtide\""
    ];
    shellHook = ''
      configure() {
        cabal configure --enable-tests '${concatStringsSep "' '" configureFlags}' "$@"
      }
      export HFILE_PATH=${harmonics}/share/xtide
      export PATH=${xtide}/bin:$PATH
    '';
    preCheck = "export TZDIR=${tzdata}/share/zoneinfo";
    description = "A program for exploring tidal prediction data";
    license = stdenv.lib.licenses.mit;
  }


{ stdenv, fetchurl, libxml2, openssl, readline, gawk }:

stdenv.mkDerivation rec {
  name = "virtuoso-opensource-6.1.7";

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

  buildInputs = [ libxml2 openssl readline gawk ];

  CPP = "${stdenv.gcc}/bin/gcc -E";

  configureFlags = "
    --enable-shared --disable-all-vads --with-readline=${readline}
    --disable-hslookup --disable-wbxml2 --without-iodbc
    --enable-openssl=${openssl}
    ";

  postInstall=''
    echo Moving documentation
    mkdir -pv $out/share/doc
    mv -v $out/share/virtuoso/doc $out/share/doc/${name}
    echo Removing jars and empty directories
    find $out -name "*.a" -delete -o -name "*.jar" -delete -o -type d -empty -delete
    '';

  meta = with stdenv.lib; {
    description = "SQL/RDF database used by, e.g., KDE-nepomuk";
    homepage = http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/;
    platforms = platforms.all;
    maintainers = [ maintainers.urkud ];
  };
}

Revert "virtuoso: update from 6.1.6 to 6.1.7"

{ stdenv, fetchurl, libxml2, openssl, readline, gawk }:

stdenv.mkDerivation rec {
  name = "virtuoso-opensource-6.1.6";

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

  buildInputs = [ libxml2 openssl readline gawk ];

  CPP = "${stdenv.gcc}/bin/gcc -E";

  configureFlags = "
    --enable-shared --disable-all-vads --with-readline=${readline}
    --disable-hslookup --disable-wbxml2 --without-iodbc
    --enable-openssl=${openssl}
    ";

  postInstall=''
    echo Moving documentation
    mkdir -pv $out/share/doc
    mv -v $out/share/virtuoso/doc $out/share/doc/${name}
    echo Removing jars and empty directories
    find $out -name "*.a" -delete -o -name "*.jar" -delete -o -type d -empty -delete
    '';

  meta = with stdenv.lib; {
    description = "SQL/RDF database used by, e.g., KDE-nepomuk";
    homepage = http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/;
    platforms = platforms.all;
    maintainers = [ maintainers.urkud ];
  };
}


{
  packageOverrides = pkgs_: with pkgs_; {
    my_vim = import ./vim-config { inherit pkgs; };

    all = with pkgs; buildEnv {
      name = "all";

      paths = [
        gitAndTools.hub
        my_vim
        ripgrep
        zsh
        zsh-completions
        zsh-prezto
        nix-zsh-completions
      ];
    };
  };
}

Add nodejs to default packages

{
  packageOverrides = pkgs_: with pkgs_; {
    my_vim = import ./vim-config { inherit pkgs; };

    all = with pkgs; buildEnv {
      name = "all";

      paths = [
        gitAndTools.hub
        my_vim
        ripgrep
        zsh
        zsh-completions
        zsh-prezto
        nix-zsh-completions
        nodejs
        nodePackages.prettier
      ];
    };
  };
}


# generate the script used to activate the configuration.
{pkgs, config, ...}:

let
  inherit (pkgs.stringsWithDeps) textClosureOverridable noDepEntry;
  inherit (pkgs.lib) mkOption mergeTypedOption mergeAttrs mapRecordFlatten mapAttrs;

  textClosure = steps:
    textClosureOverridable steps (
       [(noDepEntry "#!/bin/sh")]
    ++ (mapRecordFlatten (a: v: v) steps)
    );

  aggregateScripts = name: steps:
    pkgs.writeScript name (textClosure steps);

  addAttributeName = mapAttrs (a: v: {
      text = ''
        #### ${a} begin
        ${v.text}
        #### ${a} end
      '';
      inherit (v) deps;
    });
in

{
  system = {
    activationScripts = mkOption {
      default = [];
      example = {
        stdio = {
          text = "
            # Needed by some programs.
            ln -sfn /proc/self/fd /dev/fd
            ln -sfn /proc/self/fd/0 /dev/stdin
            ln -sfn /proc/self/fd/1 /dev/stdout
            ln -sfn /proc/self/fd/2 /dev/stderr
          ";
          deps = [];
        };
      };
      description = ''
        Activate the new configuration (i.e., update /etc, make accounts,
        and so on).
      '';
      merge = mergeTypedOption "script" builtins.isAttrs mergeAttrs;
      apply = set: let lib = addAttributeName set; in {
        inherit lib; # used to fetch dependencies.
        script = aggregateScripts "activationScript" lib;
      };
    };
  };
}

Fix activation script's merge function.

# generate the script used to activate the configuration.
{pkgs, config, ...}:

let
  inherit (pkgs.stringsWithDeps) textClosureOverridable noDepEntry;
  inherit (pkgs.lib) mkOption mergeTypedOption mergeAttrs mapRecordFlatten
    mapAttrs addErrorContext fold;

  textClosure = steps:
    textClosureOverridable steps (
       [(noDepEntry "#!/bin/sh")]
    ++ (mapRecordFlatten (a: v: v) steps)
    );

  aggregateScripts = name: steps:
    pkgs.writeScript name (textClosure steps);

  addAttributeName = mapAttrs (a: v: {
      text = ''
        #### ${a} begin
        ${v.text}
        #### ${a} end
      '';
      inherit (v) deps;
    });
in

{
  system = {
    activationScripts = mkOption {
      default = [];
      example = {
        stdio = {
          text = "
            # Needed by some programs.
            ln -sfn /proc/self/fd /dev/fd
            ln -sfn /proc/self/fd/0 /dev/stdin
            ln -sfn /proc/self/fd/1 /dev/stdout
            ln -sfn /proc/self/fd/2 /dev/stderr
          ";
          deps = [];
        };
      };
      description = ''
        Activate the new configuration (i.e., update /etc, make accounts,
        and so on).
      '';
      merge = mergeTypedOption "script" builtins.isAttrs (fold mergeAttrs {});
      apply = set:
        let lib = addAttributeName set; in {
        inherit lib; # used to fetch dependencies.
        script = aggregateScripts "activationScript" lib;
      };
    };
  };
}


{ configuration ? import ./lib/from-env.nix "NIXOS_CONFIG" <nixos-config>
, system ? builtins.currentSystem
, nixpkgs ? <nixpkgs>
}:

let

  eval = import ./lib/eval-config.nix {
    inherit system nixpkgs;
    modules = [ configuration ];
  };

  inherit (eval) config pkgs;

  # This is for `nixos-rebuild build-vm'.
  vmConfig = (import ./lib/eval-config.nix {
    inherit system nixpkgs;
    modules = [ configuration ./modules/virtualisation/qemu-vm.nix ];
  }).config;

  # This is for `nixos-rebuild build-vm-with-bootloader'.
  vmWithBootLoaderConfig = (import ./lib/eval-config.nix {
    inherit system nixpkgs;
    modules =
      [ configuration
        ./modules/virtualisation/qemu-vm.nix
        { virtualisation.useBootLoader = true; }
      ];
  }).config;

in

{
  inherit eval config;

  system = config.system.build.toplevel;

  vm = vmConfig.system.build.vm;

  vmWithBootLoader = vmWithBootLoaderConfig.system.build.vm;

  # The following are used by nixos-rebuild.
  nixFallback = pkgs.nixUnstable;

  tests = config.tests;
}

Remove reference to non-existant config.tests

{ configuration ? import ./lib/from-env.nix "NIXOS_CONFIG" <nixos-config>
, system ? builtins.currentSystem
, nixpkgs ? <nixpkgs>
}:

let

  eval = import ./lib/eval-config.nix {
    inherit system nixpkgs;
    modules = [ configuration ];
  };

  inherit (eval) config pkgs;

  # This is for `nixos-rebuild build-vm'.
  vmConfig = (import ./lib/eval-config.nix {
    inherit system nixpkgs;
    modules = [ configuration ./modules/virtualisation/qemu-vm.nix ];
  }).config;

  # This is for `nixos-rebuild build-vm-with-bootloader'.
  vmWithBootLoaderConfig = (import ./lib/eval-config.nix {
    inherit system nixpkgs;
    modules =
      [ configuration
        ./modules/virtualisation/qemu-vm.nix
        { virtualisation.useBootLoader = true; }
      ];
  }).config;

in

{
  inherit eval config;

  system = config.system.build.toplevel;

  vm = vmConfig.system.build.vm;

  vmWithBootLoader = vmWithBootLoaderConfig.system.build.vm;

  # The following are used by nixos-rebuild.
  nixFallback = pkgs.nixUnstable;
}


{ nixpkgs ? <nixpkgs> }:

let
  pkgs = import nixpkgs {};
  pkgs_darwin_x86_64 = import nixpkgs { system = "x86_64-darwin"; };
in
rec {
  kitchensink_android = import ./kitchensink {
    inherit (pkgs) fetchgit titaniumenv;
    target = "android";
  };

  kitchensink_iphone = import ./kitchensink {
    inherit (pkgs_darwin_x86_64) fetchgit titaniumenv;
    target = "iphone";
  };

  emulate_kitchensink = import ./emulate-kitchensink {
    inherit (pkgs.titaniumenv) androidenv;
    kitchensink = kitchensink_android;
  };

  simulate_kitchensink_iphone = import ./simulate-kitchensink {
    inherit (pkgs_darwin_x86_64.titaniumenv) xcodeenv;
    kitchensink = kitchensink_iphone;
    device = "iPhone";
  };

  simulate_kitchensink_ipad = import ./simulate-kitchensink {
    inherit (pkgs_darwin_x86_64.titaniumenv) xcodeenv;
    kitchensink = kitchensink_iphone;
    device = "iPad";
  };
}

Make system identifier configurable (except for iphone targets)

{ nixpkgs ? <nixpkgs>
, system ? builtins.currentSystem
}:

let
  pkgs = import nixpkgs { inherit system; };
  pkgs_darwin_x86_64 = import nixpkgs { system = "x86_64-darwin"; };
in
rec {
  kitchensink_android = import ./kitchensink {
    inherit (pkgs) fetchgit titaniumenv;
    target = "android";
  };

  kitchensink_iphone = import ./kitchensink {
    inherit (pkgs_darwin_x86_64) fetchgit titaniumenv;
    target = "iphone";
  };

  emulate_kitchensink = import ./emulate-kitchensink {
    inherit (pkgs.titaniumenv) androidenv;
    kitchensink = kitchensink_android;
  };

  simulate_kitchensink_iphone = import ./simulate-kitchensink {
    inherit (pkgs_darwin_x86_64.titaniumenv) xcodeenv;
    kitchensink = kitchensink_iphone;
    device = "iPhone";
  };

  simulate_kitchensink_ipad = import ./simulate-kitchensink {
    inherit (pkgs_darwin_x86_64.titaniumenv) xcodeenv;
    kitchensink = kitchensink_iphone;
    device = "iPad";
  };
}


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

let
  haskellPackages = let
    hp = if compiler == null then
      pkgs.haskellPackages
    else
      pkgs.haskell.packages.${compiler};
  in hp.override {
    overrides = import ../nix/haskell-packages.nix {
      inherit pkgs hoogle buildProfiling;
    };
  };

in if forShell then
  haskellPackages.shellFor ({
    packages = p: [ p.vulkan-examples ];
    buildInputs = with pkgs;
      [ vulkan-tools-lunarg vulkan-validation-layers shaderc ]
      ++ pkgs.lib.optional withSwiftshader vulkan-extension-layer;
    withHoogle = hoogle;
  } // pkgs.lib.optionalAttrs withSwiftshader {
    VK_ICD_FILENAMES =
      "${pkgs.swiftshader}/share/vulkan/icd.d/vk_swiftshader_icd.json";
  })
else
  haskellPackages.vulkan-examples

Enable timeline_semaphore layer when using swiftshader

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

let
  haskellPackages = let
    hp = if compiler == null then
      pkgs.haskellPackages
    else
      pkgs.haskell.packages.${compiler};
  in hp.override {
    overrides = import ../nix/haskell-packages.nix {
      inherit pkgs hoogle buildProfiling;
    };
  };

in if forShell then
  haskellPackages.shellFor ({
    packages = p: [ p.vulkan-examples ];
    buildInputs = with pkgs;
      [ vulkan-tools-lunarg vulkan-validation-layers shaderc ]
      ++ pkgs.lib.optional withSwiftshader vulkan-extension-layer;
    withHoogle = hoogle;
  } // pkgs.lib.optionalAttrs withSwiftshader {
    VK_ICD_FILENAMES =
      "${pkgs.swiftshader}/share/vulkan/icd.d/vk_swiftshader_icd.json";
    VK_INSTANCE_LAYERS = "VK_LAYER_KHRONOS_timeline_semaphore";
  })
else
  haskellPackages.vulkan-examples


{stdenv, fetchFromGitHub}:
stdenv.mkDerivation rec {
  name = "${pname}-${version}";
  pname = "clac";
  version = "0.0.0.20170416";

  src = fetchFromGitHub {
    owner = "soveran";
    repo = "clac";
    rev = "828600b01e80166bc435d4d73506f0c3e16f2459";
    sha256 = "08fhhvjrc7rn5fjjdqlallr76m6ybj3wm5gx407jbgfbky0fj7mb";
  };

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

  postInstall = ''
    mkdir -p "$out/share/doc/${pname}"
    cp README* LICENSE "$out/share/doc/${pname}"
  '';

  meta = {
    inherit version;
    description = "Interactive stack-based calculator";
    license = stdenv.lib.licenses.bsd2;
    maintainers = [stdenv.lib.maintainers.raskin];
    platforms = stdenv.lib.platforms.linux;
    homepage = "https://github.com/soveran/clac";
  };
}

Set clac.meta.platforms to "unix" instead of "linux"

{stdenv, fetchFromGitHub}:
stdenv.mkDerivation rec {
  name = "${pname}-${version}";
  pname = "clac";
  version = "0.0.0.20170416";

  src = fetchFromGitHub {
    owner = "soveran";
    repo = "clac";
    rev = "828600b01e80166bc435d4d73506f0c3e16f2459";
    sha256 = "08fhhvjrc7rn5fjjdqlallr76m6ybj3wm5gx407jbgfbky0fj7mb";
  };

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

  postInstall = ''
    mkdir -p "$out/share/doc/${pname}"
    cp README* LICENSE "$out/share/doc/${pname}"
  '';

  meta = {
    inherit version;
    description = "Interactive stack-based calculator";
    license = stdenv.lib.licenses.bsd2;
    maintainers = [stdenv.lib.maintainers.raskin];
    platforms = stdenv.lib.platforms.unix;
    homepage = "https://github.com/soveran/clac";
  };
}


{stdenv, fetchurl, which, cryptopp, ocaml, findlib, ocaml_react, ocaml_ssl}:

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

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

  src = fetchurl {
    url = "http://ocsigen.org/download/lwt-${version}.tar.gz";
    sha256 = "1zjn0sgihryshancn4kna1xslhc8gifliny1qd3a85f72xxxnw0w";
  };

  buildInputs = [which cryptopp ocaml findlib ocaml_react ocaml_ssl];

  configurePhase = "true";

  meta = {
    homepage = http://ocsigen.org/lwt;
    description = "Lightweight thread library for Objective Caml";
    license = "LGPL";
    platforms = ocaml.meta.platforms;
    maintainers = [
      stdenv.lib.maintainers.z77z
    ];
  };
}

Update ocaml_lwt to version 2.4.5 (from git)

{stdenv, fetchgit, which, cryptopp, ocaml, findlib, ocaml_react, ocaml_ssl, libev, pkgconfig, ncurses, ocaml_oasis, ocaml_text, glib}:

let
  version = "2.4.5";
in

stdenv.mkDerivation {

  name = "ocaml-lwt-${version}";

  src = fetchgit {
    url = git://github.com/ocsigen/lwt;
    rev = "refs/tags/${version}";
    sha256 = "2bbf4f216dd62eeb765a89413f3b2b6d417a9c289ca49d595bb4d7a0545e343e";
  };

  buildInputs = [ocaml_oasis pkgconfig which cryptopp ocaml findlib ocaml_react ocaml_ssl libev ncurses ocaml_text glib];

  configureFlags = [ "--enable-all" ];

  createFindlibDestdir = true;

  meta = {
    homepage = http://ocsigen.org/lwt;
    description = "Lightweight thread library for Objective Caml";
    license = "LGPL";
    platforms = ocaml.meta.platforms;
    maintainers = [
      stdenv.lib.maintainers.z77z stdenv.lib.maintainers.gal_bolle
    ];
  };
}


{ stdenv, cmake, fetchgit, ncurses }:

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

  src = fetchgit {
    url = "https://github.com/Acolarh/ctodo.git";
    rev = "de478f5028a1b167bfdb6dd4160d83d9ef7db839";
    sha256 = "3a43a6237e8fe5b37ca7d5abc88c20158f2cff1f8b98762c404e6f24d4b7993e";
  };

  buildInputs = [ stdenv cmake ncurses ];

  configurePhase = ''
    cmake -DCMAKE_INSTALL_PREFIX=$out .
  '';

  meta = {
    homepage = "http://ctodo.apakoh.dk/";
    description = "A simple ncurses-based task list manager.";
    license = stdenv.lib.licenses.mit;
    maintainers = [ stdenv.lib.maintainers.matthiasbeyer ];
  };
}

Use archive instead of git clone

{ stdenv, cmake, fetchurl, ncurses }:

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

  src = fetchurl {
    url = "https://github.com/Acolarh/ctodo/archive/v1.1.tar.gz";
    sha256 = "1sv5p1b08pp73qshakz4qy4pjglxz2pvx2cjfx52i3532hd3xcaf";
  };

  buildInputs = [ stdenv cmake ncurses ];

  configurePhase = ''
    cmake -DCMAKE_INSTALL_PREFIX=$out .
  '';

  meta = {
    homepage = "http://ctodo.apakoh.dk/";
    description = "A simple ncurses-based task list manager.";
    license = stdenv.lib.licenses.mit;
    maintainers = [ stdenv.lib.maintainers.matthiasbeyer ];
  };
}


{ stdenv, fetchurl, openssl, coreutils }:

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

  src = fetchurl {
    url    = "http://www.tarsnap.com/spiped/${name}.tgz";
    sha256 = "0pyg1llnqgfx7n7mi3dq4ra9xg3vkxlf01z5jzn7ncq5d6ii7ynq";
  };

  buildInputs = [ openssl ];
  patches = [ ./no-dev-stderr.patch ];

  postPatch = ''
    substituteInPlace POSIX/posix-l.sh --replace "rm" "${coreutils}/bin/rm"
  '';

  installPhase = ''
    mkdir -p $out/bin $out/share/man/man1
    make install BINDIR=$out/bin MAN1DIR=$out/share/man/man1
  '';

  meta = {
    description = "utility for secure encrypted channels between sockets";
    homepage    = "https://www.tarsnap.com/spiped.html";
    license     = stdenv.lib.licenses.bsd2;
    platforms   = stdenv.lib.platforms.unix;
    maintainers = [ stdenv.lib.maintainers.thoughtpolice ];
  };
}

Revert "spiped: 1.3.1 -> 1.4.0"

{ stdenv, fetchurl, openssl, coreutils }:

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

  src = fetchurl {
    url    = "http://www.tarsnap.com/spiped/${name}.tgz";
    sha256 = "1viglk61v1v2ga1n31r0h8rvib5gy2h02lhhbbnqh2s6ps1sjn4a";
  };

  buildInputs = [ openssl ];
  patches = [ ./no-dev-stderr.patch ];

  postPatch = ''
    substituteInPlace POSIX/posix-l.sh --replace "rm" "${coreutils}/bin/rm"
  '';

  installPhase = ''
    mkdir -p $out/bin $out/share/man/man1
    make install BINDIR=$out/bin MAN1DIR=$out/share/man/man1
  '';

  meta = {
    description = "utility for secure encrypted channels between sockets";
    homepage    = "https://www.tarsnap.com/spiped.html";
    license     = stdenv.lib.licenses.bsd2;
    platforms   = stdenv.lib.platforms.unix;
    maintainers = [ stdenv.lib.maintainers.thoughtpolice ];
  };
}


{ stdenv, fetchurl, pythonPackages }:

pythonPackages.buildPythonApplication rec {
  name = "radicale-${version}";
  version = "1.1.1";

  src = fetchurl {
    url = "mirror://pypi/R/Radicale/Radicale-${version}.tar.gz";
    sha256 = "1c5lv8qca21mndkx350wxv34qypqh6gb4rhzms4anr642clq3jg2";
  };

  propagatedBuildInputs = [
    pythonPackages.flup
    pythonPackages.ldap
    pythonPackages.sqlalchemy
  ];

  doCheck = true;

  meta = with stdenv.lib; {
    homepage = http://www.radicale.org/;
    description = "CalDAV CardDAV server";
    longDescription = ''
      The Radicale Project is a complete CalDAV (calendar) and CardDAV
      (contact) server solution. Calendars and address books are available for
      both local and remote access, possibly limited through authentication
      policies. They can be viewed and edited by calendar and contact clients
      on mobile phones or computers.
    '';
    license = licenses.gpl3Plus;
    platform = platforms.all;
    maintainers = with maintainers; [ edwtjo pSub ];
  };
}

Remove optional deps on Python 3

{ stdenv, fetchurl, pythonPackages }:

pythonPackages.buildPythonApplication rec {
  name = "radicale-${version}";
  version = "1.1.1";

  src = fetchurl {
    url = "mirror://pypi/R/Radicale/Radicale-${version}.tar.gz";
    sha256 = "1c5lv8qca21mndkx350wxv34qypqh6gb4rhzms4anr642clq3jg2";
  };

  propagatedBuildInputs = stdenv.lib.optionals (!pythonPackages.isPy3k) [
    pythonPackages.flup
    pythonPackages.ldap
    pythonPackages.sqlalchemy
  ];

  doCheck = true;

  meta = with stdenv.lib; {
    homepage = http://www.radicale.org/;
    description = "CalDAV CardDAV server";
    longDescription = ''
      The Radicale Project is a complete CalDAV (calendar) and CardDAV
      (contact) server solution. Calendars and address books are available for
      both local and remote access, possibly limited through authentication
      policies. They can be viewed and edited by calendar and contact clients
      on mobile phones or computers.
    '';
    license = licenses.gpl3Plus;
    platform = platforms.all;
    maintainers = with maintainers; [ edwtjo pSub ];
  };
}


a :
let
  fetchurl = a.fetchurl;

  version = a.lib.attrByPath ["version"] "r8541" a;
  buildInputs = with a; [
    gtk glib pkgconfig libX11
  ];
in
rec {
  src = fetchurl {
    url = "http://www.chiark.greenend.org.uk/~sgtatham/puzzles/puzzles-${version}.tar.gz";
    sha256 = "1m6fybbvlx33786hmgraqxgm1hakfj9bqqszzzpi2ka4spfzj3xl";
  };

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

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

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

  doExport = a.noDepEntry ''
    export NIX_LDFLAGS="$NIX_LDFLAGS -L${a.libX11}/lib -lX11"
  '';

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

Update SGT Puzzles source. Use SVN to solve the problem with disappearing source

a :
let
  fetchsvn = a.fetchsvn;

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

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

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

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

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

  doExport = a.noDepEntry ''
    export NIX_LDFLAGS="$NIX_LDFLAGS -L${a.libX11}/lib -lX11"
  '';

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


{ lib
, aiohttp
, async-timeout
, aresponses
, buildPythonPackage
, fetchFromGitHub
, poetry
, pylint
, pytest-aiohttp
, pytest-asyncio
, pytestCheckHook
, pythonAtLeast
}:
buildPythonPackage rec {
  pname = "pytile";
  version = "5.1.0";
  disabled = pythonAtLeast "3.9";

  src = fetchFromGitHub {
    owner = "bachya";
    repo = pname;
    rev = version;
    sha256 = "0hdyb8ca4ihqf7yfkr3hbpkwz7g182ycra151y5dxn0319fillc3";
  };

  format = "pyproject";

  nativeBuildInputs = [ poetry ];

  propagatedBuildInputs = [
    aiohttp
    pylint
  ];

  checkInputs = [
    aresponses
    pytest-aiohttp
    pytest-asyncio
    pytestCheckHook
  ];

  # Ignore the examples as they are prefixed with test_
  pytestFlagsArray = [ "--ignore examples/" ];
  pythonImportsCheck = [ "pytile" ];

  meta = with lib; {
    description = " Python API for Tile Bluetooth trackers";
    longDescription = ''
      pytile is a simple Python library for retrieving information on Tile
      Bluetooth trackers (including last location and more).
    '';
    homepage = "https://github.com/bachya/pytile";
    license = with licenses; [ mit ];
    maintainers = with maintainers; [ fab ];
  };
}

Fix tests with darwin sandbox

{ lib
, aiohttp
, async-timeout
, aresponses
, buildPythonPackage
, fetchFromGitHub
, poetry
, pylint
, pytest-aiohttp
, pytest-asyncio
, pytestCheckHook
, pythonAtLeast
}:
buildPythonPackage rec {
  pname = "pytile";
  version = "5.1.0";
  disabled = pythonAtLeast "3.9";

  src = fetchFromGitHub {
    owner = "bachya";
    repo = pname;
    rev = version;
    sha256 = "0hdyb8ca4ihqf7yfkr3hbpkwz7g182ycra151y5dxn0319fillc3";
  };

  format = "pyproject";

  nativeBuildInputs = [ poetry ];

  propagatedBuildInputs = [
    aiohttp
    pylint
  ];

  checkInputs = [
    aresponses
    pytest-aiohttp
    pytest-asyncio
    pytestCheckHook
  ];

  # Ignore the examples as they are prefixed with test_
  pytestFlagsArray = [ "--ignore examples/" ];
  pythonImportsCheck = [ "pytile" ];

  __darwinAllowLocalNetworking = true;

  meta = with lib; {
    description = " Python API for Tile Bluetooth trackers";
    longDescription = ''
      pytile is a simple Python library for retrieving information on Tile
      Bluetooth trackers (including last location and more).
    '';
    homepage = "https://github.com/bachya/pytile";
    license = with licenses; [ mit ];
    maintainers = with maintainers; [ fab ];
  };
}


{ config, lib, ... }:

with lib;

{
  options = {

    system.defaults.dock.autohide = mkOption {
      type = types.nullOr types.bool;
      default = null;
      description = ''
        Whether to automatically hide and show the dock.  The default is false.
      '';
    };

    system.defaults.dock.orientation = mkOption {
      type = types.nullOr (types.enum [ "bottom" "left" "right" ]);
      default = null;
      description = ''
        Position of the dock on screen.  The default is "bottom".
      '';
    };

    system.defaults.dock.showhidden = mkOption {
      type = types.nullOr types.bool;
      default = null;
      description = ''
        Whether to make icons of hidden applications tranclucent.  The default is false.
      '';
    };

    system.defaults.dock.minimize-to-application = mkOption {
      type = types.nullOr types.bool;
      default = null;
      description = ''
        Whether to minimize windows into their application icon.  The default is false.
      '';
    };

    system.defaults.dock.mru-spaces = mkOption {
      type = types.nullOr types.bool;
      default = null;
      description = ''
        Whether to automatically rearrange spaces based on most recent use.  The default is true.
      '';
    };

  };
}

Add support for Dock icon size

{ config, lib, ... }:

with lib;

{
  options = {

    system.defaults.dock.autohide = mkOption {
      type = types.nullOr types.bool;
      default = null;
      description = ''
        Whether to automatically hide and show the dock.  The default is false.
      '';
    };

    system.defaults.dock.orientation = mkOption {
      type = types.nullOr (types.enum [ "bottom" "left" "right" ]);
      default = null;
      description = ''
        Position of the dock on screen.  The default is "bottom".
      '';
    };

    system.defaults.dock.showhidden = mkOption {
      type = types.nullOr types.bool;
      default = null;
      description = ''
        Whether to make icons of hidden applications tranclucent.  The default is false.
      '';
    };

    system.defaults.dock.tilesize = mkOption {
      type = types.nullOr types.int;
      default = null;
      description = ''
        Size of the icons in the dock.  The default is 64.
      '';
    };

    system.defaults.dock.minimize-to-application = mkOption {
      type = types.nullOr types.bool;
      default = null;
      description = ''
        Whether to minimize windows into their application icon.  The default is false.
      '';
    };

    system.defaults.dock.mru-spaces = mkOption {
      type = types.nullOr types.bool;
      default = null;
      description = ''
        Whether to automatically rearrange spaces based on most recent use.  The default is true.
      '';
    };

  };
}


{ stdenv, buildGoPackage, fetchFromGitHub }:

buildGoPackage rec {
  pname = "dnscrypt-proxy2";
  version = "2.0.39";

  goPackagePath = "github.com/jedisct1/dnscrypt-proxy";

  src = fetchFromGitHub {
    owner = "jedisct1";
    repo = "dnscrypt-proxy";
    rev = version;
    sha256 = "0fvnp2brmqkwn04v01k53f9djk9ywa1cg26m2frhv4lj0581430y";
  };

  meta = with stdenv.lib; {
    description = "A tool that provides secure DNS resolution";

    license = licenses.isc;
    homepage = https://dnscrypt.info/;
    maintainers = with maintainers; [ waynr ];
    platforms = with platforms; unix;
  };
}

Add Atemu to the maintainers

{ stdenv, buildGoPackage, fetchFromGitHub }:

buildGoPackage rec {
  pname = "dnscrypt-proxy2";
  version = "2.0.39";

  goPackagePath = "github.com/jedisct1/dnscrypt-proxy";

  src = fetchFromGitHub {
    owner = "jedisct1";
    repo = "dnscrypt-proxy";
    rev = version;
    sha256 = "0fvnp2brmqkwn04v01k53f9djk9ywa1cg26m2frhv4lj0581430y";
  };

  meta = with stdenv.lib; {
    description = "A tool that provides secure DNS resolution";

    license = licenses.isc;
    homepage = https://dnscrypt.info/;
    maintainers = with maintainers; [ atemu waynr ];
    platforms = with platforms; unix;
  };
}


{ automoc4, cmake, kde, kdelibs, qt4, strigi, soprano, shared_desktop_ontologies
, bzip2, xz, shared_mime_info, libssh, exiv2, attica, phonon, libcanberra
, virtuoso, makeWrapper
}:

kde.package {

  buildInputs =
    [ phonon cmake kdelibs qt4 automoc4 strigi soprano
      shared_desktop_ontologies bzip2 xz shared_mime_info libssh
      exiv2 attica virtuoso makeWrapper
      (libcanberra.override { gtk = null; })
    ];

# Copied from kde45, Nepomuk needs it.
  postInstall = ''
    wrapProgram "$out/bin/nepomukservicestub" --prefix LD_LIBRARY_PATH : "${virtuoso}/lib" \
        --prefix PATH : "${virtuoso}/bin"
  '';

  meta = {
    license = "LGPL";
    kde.name = "kde-runtime";
  };

}

Add samba and ntrack to deps

{ automoc4, cmake, kde, kdelibs, qt4, strigi, soprano, shared_desktop_ontologies
, bzip2, xz, shared_mime_info, libssh, exiv2, attica, phonon, libcanberra
, virtuoso, makeWrapper, samba, ntrack
}:

kde.package {

  buildInputs =
    [ phonon cmake kdelibs qt4 automoc4 strigi soprano
      shared_desktop_ontologies bzip2 xz shared_mime_info libssh
      exiv2 attica virtuoso makeWrapper samba ntrack
      (libcanberra.override { gtk = null; })
    ];

# Copied from kde45, Nepomuk needs it.
  postInstall = ''
    wrapProgram "$out/bin/nepomukservicestub" --prefix LD_LIBRARY_PATH : "${virtuoso}/lib" \
        --prefix PATH : "${virtuoso}/bin"
  '';

  meta = {
    license = "LGPL";
    kde.name = "kde-runtime";
  };

}


{ lib, stdenv, fetchurl, makeWrapper, openjdk11_headless, nixosTests }:

stdenv.mkDerivation rec {
  pname = "graylog";
  version = "4.0.7";

  src = fetchurl {
    url = "https://packages.graylog2.org/releases/graylog/graylog-${version}.tgz";
    sha256 = "sha256-sZn/ug4oh/SHbICbiQeAmtEIwT3++DBWbT2XBkYGYUc=";
  };

  dontBuild = true;
  dontStrip = true;

  nativeBuildInputs = [ makeWrapper ];
  makeWrapperArgs = [ "--set-default" "JAVA_HOME" "${openjdk11_headless}" ];

  passthru.tests = { inherit (nixosTests) graylog; };

  installPhase = ''
    mkdir -p $out
    cp -r {graylog.jar,lib,bin,plugin} $out
    wrapProgram $out/bin/graylogctl $makeWrapperArgs
  '';

  meta = with lib; {
    description = "Open source log management solution";
    homepage    = "https://www.graylog.org/";
    license     = licenses.gpl3;
    platforms   = platforms.unix;
    maintainers = [ maintainers.fadenb ];
  };
}

Revert "graylog: 3.3.9 -> 4.0.7"

{ lib, stdenv, fetchurl, makeWrapper, openjdk11_headless, nixosTests }:

stdenv.mkDerivation rec {
  pname = "graylog";
  version = "3.3.9";

  src = fetchurl {
    url = "https://packages.graylog2.org/releases/graylog/graylog-${version}.tgz";
    sha256 = "1wl9j2jgjg5gwcsh92qr5f68wx12nvwadc9xkaa9wwd7x3z825jq";
  };

  dontBuild = true;
  dontStrip = true;

  nativeBuildInputs = [ makeWrapper ];
  makeWrapperArgs = [ "--set-default" "JAVA_HOME" "${openjdk11_headless}" ];

  passthru.tests = { inherit (nixosTests) graylog; };

  installPhase = ''
    mkdir -p $out
    cp -r {graylog.jar,lib,bin,plugin} $out
    wrapProgram $out/bin/graylogctl $makeWrapperArgs
  '';

  meta = with lib; {
    description = "Open source log management solution";
    homepage    = "https://www.graylog.org/";
    license     = licenses.gpl3;
    platforms   = platforms.unix;
    maintainers = [ maintainers.fadenb ];
  };
}


{ stdenv
, buildPythonPackage
, fetchPypi
, numpy
, decorator
, imageio
, isPy3k
, tqdm
}:

buildPythonPackage rec {
  pname = "moviepy";
  version = "1.0.0";

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

  # No tests
  doCheck = false;
  propagatedBuildInputs = [ numpy decorator imageio tqdm ];

  meta = with stdenv.lib; {
    description = "Video editing with Python";
    homepage = http://zulko.github.io/moviepy/;
    license = licenses.mit;
  };

}

Add deps for new version

{ stdenv
, buildPythonPackage
, fetchPypi
, numpy
, decorator
, imageio
, imageio-ffmpeg
, isPy3k
, proglog
, requests
, tqdm
}:

buildPythonPackage rec {
  pname = "moviepy";
  version = "1.0.0";

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

  # No tests
  doCheck = false;
  propagatedBuildInputs = [ numpy decorator imageio imageio-ffmpeg tqdm requests proglog ];

  meta = with stdenv.lib; {
    description = "Video editing with Python";
    homepage = http://zulko.github.io/moviepy/;
    license = licenses.mit;
  };

}


{pkgs, config, ...}:

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

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

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

Use the right iwl4965 firmware depending on the kernel version.

{pkgs, config, ...}:

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

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

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


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

with lib;

{
  ###### interface

  options = {

    hardware.trackpoint = {

      enable = mkOption {
        default = false;
        type = types.bool;
        description = ''
          Enable sensitivity and speed configuration for trackpoints.
        '';
      };

      sensitivity = mkOption {
        default = 128;
        example = 255;
        type = types.int;
        description = ''
          Configure the trackpoint sensitivity. By default, the kernel
          configures 128.
        '';
      };

      speed = mkOption {
        default = 97;
        example = 255;
        type = types.int;
        description = ''
          Configure the trackpoint sensitivity. By default, the kernel
          configures 97.
        '';
      };

    };

  };

  ###### implementation

  config = mkIf config.hardware.trackpoint.enable {

    services.udev.extraRules =
    ''
      ACTION=="add|change", SUBSYSTEM=="input", ATTR{name}=="TPPS/2 IBM TrackPoint", ATTR{device/speed}="${toString config.hardware.trackpoint.speed}", ATTR{device/sensitivity}="${toString config.hardware.trackpoint.sensitivity}"
    '';
  };

}

Add activationScript for TrackPoint configuration

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

with lib;

{
  ###### interface

  options = {

    hardware.trackpoint = {

      enable = mkOption {
        default = false;
        type = types.bool;
        description = ''
          Enable sensitivity and speed configuration for trackpoints.
        '';
      };

      sensitivity = mkOption {
        default = 128;
        example = 255;
        type = types.int;
        description = ''
          Configure the trackpoint sensitivity. By default, the kernel
          configures 128.
        '';
      };

      speed = mkOption {
        default = 97;
        example = 255;
        type = types.int;
        description = ''
          Configure the trackpoint sensitivity. By default, the kernel
          configures 97.
        '';
      };

    };

  };

  ###### implementation

  config = mkIf config.hardware.trackpoint.enable {

    services.udev.extraRules =
    ''
      ACTION=="add|change", SUBSYSTEM=="input", ATTR{name}=="TPPS/2 IBM TrackPoint", ATTR{device/speed}="${toString config.hardware.trackpoint.speed}", ATTR{device/sensitivity}="${toString config.hardware.trackpoint.sensitivity}"
    '';

    system.activationScripts.trackpoint =
      ''
        ${config.systemd.package}/bin/udevadm trigger --attr-match=name="TPPS/2 IBM TrackPoint"
      '';
  };

}


{ fetchurl, stdenv, libuuid, popt, icu }:

stdenv.mkDerivation rec {
  name = "gptfdisk-0.7.1";

  src = fetchurl {
    url = "http://www.rodsbooks.com/gdisk/${name}.tgz";
    sha256 = "142mrlcaprh7a6r55wvaxpvjmkffh7w8lcagarmwq4cfibfrnwd8";
  };

  buildInputs = [ libuuid popt icu ];

  installPhase = ''
    ensureDir $out/bin
    ensureDir $out/share/man/man8
    install -v -m755 gdisk sgdisk fixparts $out/bin
    install -v -m644 gdisk.8 sgdisk.8 fixparts.8 \
        $out/share/man/man8
  '';

  meta = {
    description = "A set of text-mode partitioning tools for Globally Unique Identifier (GUID) Partition Table (GPT) disks";

    license = "GPLv2";

    homepage = http://www.rodsbooks.com/gdisk/;

    maintainers = stdenv.lib.maintainers.shlevy;
    platforms = stdenv.lib.platforms.linux;
  };
}

Move system binaries to /sbin instead of /bin

{ fetchurl, stdenv, libuuid, popt, icu }:

stdenv.mkDerivation rec {
  name = "gptfdisk-0.7.1";

  src = fetchurl {
    url = "http://www.rodsbooks.com/gdisk/${name}.tgz";
    sha256 = "142mrlcaprh7a6r55wvaxpvjmkffh7w8lcagarmwq4cfibfrnwd8";
  };

  buildInputs = [ libuuid popt icu ];

  installPhase = ''
    ensureDir $out/sbin
    ensureDir $out/share/man/man8
    install -v -m755 gdisk sgdisk fixparts $out/sbin
    install -v -m644 gdisk.8 sgdisk.8 fixparts.8 \
        $out/share/man/man8
  '';

  meta = {
    description = "A set of text-mode partitioning tools for Globally Unique Identifier (GUID) Partition Table (GPT) disks";

    license = "GPLv2";

    homepage = http://www.rodsbooks.com/gdisk/;

    maintainers = stdenv.lib.maintainers.shlevy;
    platforms = stdenv.lib.platforms.linux;
  };
}


{ stdenv, fetchzip }:

let
  version = "3.4";
in fetchzip {
  name = "inter-${version}";

  url = "https://github.com/rsms/inter/releases/download/v${version}/Inter-${version}.zip";

  postFetch = ''
    mkdir -p $out/share/fonts/opentype
    unzip -j $downloadedFile \*.otf -d $out/share/fonts/opentype
  '';

  sha256 = "1dl4zc1a5dl9xkg094zmzy6bk7gms8vhsiln58ix7sffzcf3pri8";

  meta = with stdenv.lib; {
    homepage = https://rsms.me/inter/;
    description = "A typeface specially designed for user interfaces";
    license = licenses.ofl;
    platforms = platforms.all;
    maintainers = with maintainers; [ demize ];
  };
}

Revert "inter(-ui): 3.3 -> 3.4"

{ stdenv, fetchzip }:

let
  version = "3.3";
in fetchzip {
  name = "inter-${version}";

  url = "https://github.com/rsms/inter/releases/download/v${version}/Inter-${version}.zip";

  postFetch = ''
    mkdir -p $out/share/fonts/opentype
    unzip -j $downloadedFile \*.otf -d $out/share/fonts/opentype
  '';

  sha256 = "17fv33ryvbla4f4mfgw7m7gjlwyjlni90a8gpb7jws1qzn0vgazg";

  meta = with stdenv.lib; {
    homepage = https://rsms.me/inter/;
    description = "A typeface specially designed for user interfaces";
    license = licenses.ofl;
    platforms = platforms.all;
    maintainers = with maintainers; [ demize ];
  };
}


let
  pkgs = import <nixpkgs> {};
in
 pkgs.poetry2nix.mkPoetryApplication {
    projectDir = ../.;
    overrides = pkgs.poetry2nix.overrides.withDefaults (self: super: {
      pytest = super.pytest.overrideAttrs (old: {
        postPatch = old.postPatch or "" + ''
          sed -i '/\[metadata\]/aversion = ${old.version}' setup.cfg
          echo "VERSION"
          grep version setup.cfg
        '';
      });
    });
  }

Remove pytest override in nix environment.

let
  pkgs = import <nixpkgs> {};
in
 pkgs.poetry2nix.mkPoetryApplication {
    projectDir = ../.;
  }


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

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

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

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

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

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

  # 10 tests are failing
  doCheck = false;

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

Update to new upstream version 1.3.9.

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

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

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

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

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

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

  # 10 tests are failing
  doCheck = false;

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


{ config, pkgs, ... }:

{
  imports = [
    ../common.nix
    ../graphical.nix
    ../libinput.nix
    ../yubikey.nix
    ../../hardware-configuration.nix # Include the results of the hardware scan.
  ];

  # For Broadcom chip
  boot.kernelPackages = pkgs.linuxPackages_latest;

  boot.loader.systemd-boot.enable = true;
  boot.loader.efi.canTouchEfiVariables = true;

  services.xserver.videoDrivers = [ "nvidia" "intel" ];
  hardware.opengl.driSupport32Bit = true;
  #boot.blacklistedKernelModules = [ "i915" ];

  networking.hostName = "John-Galois-NixOS"; # Define your hostname.

  # Hardware config generater currently ignores mountpoints using FUSE
  fileSystems."/exchange" = {
    device = "/dev/sda5";
    fsType = "exfat";
  };

  # The NixOS release to be compatible with for stateful data such as databases.
  system.stateVersion = "17.03";
}

Use labels to mount exchange exFat

{ config, pkgs, ... }:

{
  imports = [
    ../common.nix
    ../graphical.nix
    ../libinput.nix
    ../yubikey.nix
    ../../hardware-configuration.nix # Include the results of the hardware scan.
  ];

  # For Broadcom chip
  boot.kernelPackages = pkgs.linuxPackages_latest;

  boot.loader.systemd-boot.enable = true;
  boot.loader.efi.canTouchEfiVariables = true;

  services.xserver.videoDrivers = [ "nvidia" "intel" ];
  hardware.opengl.driSupport32Bit = true;
  #boot.blacklistedKernelModules = [ "i915" ];

  networking.hostName = "John-Galois-NixOS"; # Define your hostname.

  # Hardware config generater currently ignores mountpoints using FUSE
  fileSystems."/exchange" = {
    device = "/dev/disk/by-partlabel/exchange";
    fsType = "exfat";
  };

  # The NixOS release to be compatible with for stateful data such as databases.
  system.stateVersion = "17.03";
}


{ stdenv, fetchgit, cmake, boost, gmp, mpfr, libedit, python, texinfo }:

stdenv.mkDerivation {
  name = "ledger-3.0.1";
  version = "3.0.1";

  src = ./.;

  buildInputs = [ cmake boost gmp mpfr libedit python texinfo ];

  # Tests on Darwin are failing
  doCheck = !stdenv.isDarwin;
  enableParallelBuilding = true;

  meta = {
    homepage = "http://ledger-cli.org/";
    description = "A double-entry accounting system with a command-line reporting interface";
    license = "BSD";

    longDescription = ''
      Ledger is a powerful, double-entry accounting system that is accessed
      from the UNIX command-line. This may put off some users, as there is
      no flashy UI, but for those who want unparalleled reporting access to
      their data, there really is no alternative.
    '';

    platforms = stdenv.lib.platforms.all;
    maintainers = with stdenv.lib.maintainers; [ simons the-kenny ];
  };
}

Add ninja as a build dependency

{ stdenv, fetchgit, cmake, ninja, boost, gmp, mpfr, libedit, python, texinfo }:

stdenv.mkDerivation {
  name = "ledger-3.0.1";
  version = "3.0.1";

  src = ./.;

  buildInputs = [ cmake ninja boost gmp mpfr libedit python texinfo ];

  # Tests on Darwin are failing
  doCheck = !stdenv.isDarwin;
  enableParallelBuilding = true;

  meta = {
    homepage = "http://ledger-cli.org/";
    description = "A double-entry accounting system with a command-line reporting interface";
    license = "BSD";

    longDescription = ''
      Ledger is a powerful, double-entry accounting system that is accessed
      from the UNIX command-line. This may put off some users, as there is
      no flashy UI, but for those who want unparalleled reporting access to
      their data, there really is no alternative.
    '';

    platforms = stdenv.lib.platforms.all;
    maintainers = with stdenv.lib.maintainers; [ simons the-kenny ];
  };
}


{
  description = "A flake for building ush";

  inputs.nixpkgs.url = github:NixOS/nixpkgs/nixos-unstable;

  outputs = { self, nixpkgs }: {
    defaultPackage.x86_64-linux =
      with import nixpkgs { system = "x86_64-linux"; };
      stdenv.mkDerivation rec {
        pname = "ush";
        version = "0.72";

        src = self;

        nativeBuildInputs = [
          meson
          ninja
          pkg-config
        ];

        buildInputs = [ libedit ];

        meta = with lib; {
          description = "small personal shell";
          homepage = "https://qirus.net";
          license = licenses.bsd3;
          maintainers = with maintainers; [ hjones2199 ];
        };
      };
  };
}

Add RISCV cross-compilation via nix

{
  description = "A flake for building ush";

  inputs.nixpkgs.url = github:NixOS/nixpkgs/nixos-unstable;

  outputs = { self, nixpkgs }: {
    defaultPackage.x86_64-linux =
      with import nixpkgs { system = "x86_64-linux"; };
        stdenv.mkDerivation rec {
          pname = "ush";
          version = "0.72";

          src = self;

          nativeBuildInputs = [
            meson
            ninja
            pkg-config
          ];

          buildInputs = [ libedit ];

          meta = with lib; {
            description = "small personal shell";
            homepage = "https://qirus.net";
            maintainers = with maintainers; [ hjones2199 ];
            license = licenses.bsd3;
            platforms = platforms.linux;
          };
        };
    riscvPackage =
      with import nixpkgs { system = "x86_64-linux"; crossSystem = nixpkgs.lib.systems.examples.riscv64; };
        stdenv.mkDerivation rec {
          pname = "ush";
          version = "0.72";

          src = self;

          nativeBuildInputs = [
            meson
            ninja
            pkg-config
          ];

          buildInputs = [ libedit ];

          meta = with lib; {
            description = "small personal shell";
            homepage = "https://qirus.net";
            maintainers = with maintainers; [ hjones2199 ];
            license = licenses.bsd3;
            platforms = platforms.linux;
          };
        };
  };
}


{ stdenv, fetchurl, libxml2Python, libxslt, makeWrapper
, python, pyserial, pygtk
}:

stdenv.mkDerivation rec {
  name = "chirp-daily-${version}";
  version = "20170311";

  src = fetchurl {
    url = "http://trac.chirp.danplanet.com/chirp_daily/daily-${version}/${name}.tar.gz";
    sha256 = "0mvj650vm3bfk94b174gl99fj4jigrx38f1iciz1cp3gn8hcrcpj";
  };

  nativeBuildInputs = [ makeWrapper ];
  buildInputs = [
    pyserial pygtk libxml2Python libxslt pyserial
  ];

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

  installPhase = ''
    mkdir -p $out/bin $out/share/chirp
    cp -r . $out/share/chirp/
    ln -s $out/share/chirp/chirpw $out/bin/chirpw

    for file in "$out"/bin/*; do
      wrapProgram "$file" \
        --prefix PYTHONPATH : $PYTHONPATH:$(toPythonPath "$out")
    done
  '';

  meta = with stdenv.lib; {
    description = "A free, open-source tool for programming your amateur radio";
    homepage = http://chirp.danplanet.com/;
    license = licenses.gpl3;
    platforms = platforms.linux;
    maintainers = [ maintainers.the-kenny ];
  };
}

Revert "chirp: 20161018 -> 20170311"

{ stdenv, fetchurl, libxml2Python, libxslt, makeWrapper
, python, pyserial, pygtk
}:
let
  version = "20161018";
in
stdenv.mkDerivation rec {
  name = "chirp-daily-${version}";
  inherit version;

  src = fetchurl {
    url = "http://trac.chirp.danplanet.com/chirp_daily/daily-${version}/chirp-daily-${version}.tar.gz";
    sha256 = "0f3r919az4vvcgxzqmxvhrxa2byzk5algy7srzzs15ihkvyxcwkb";
  };

  buildInputs = [
    makeWrapper
    pyserial pygtk libxml2Python libxslt pyserial
  ];

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

  installPhase = ''
    mkdir -p $out/bin $out/share/chirp
    cp -r . $out/share/chirp/
    ln -s $out/share/chirp/chirpw $out/bin/chirpw

    for file in "$out"/bin/*; do
      wrapProgram "$file" \
        --prefix PYTHONPATH : $PYTHONPATH:$(toPythonPath "$out")
    done
  '';

  meta = with stdenv.lib; {
    description = "A free, open-source tool for programming your amateur radio";
    homepage = http://chirp.danplanet.com/;
    license = licenses.gpl3;
    platforms = platforms.linux;
    maintainers = [ maintainers.the-kenny ];
  };
}


{ stdenv, fetchurl, groff }:

stdenv.mkDerivation rec {
  name = "mdadm-3.3";

  src = fetchurl {
    url = "mirror://kernel/linux/utils/raid/mdadm/${name}.tar.bz2";
    sha256 = "0igdqflihiq1dp5qlypzw0xfl44f4n3bckl7r2x2wfgkplcfa1ww";
  };

  nativeBuildInputs = [ groff ];

  preConfigure = "sed -e 's@/lib/udev@\${out}/lib/udev@' -e 's@ -Werror @ @' -i Makefile";

  # Force mdadm to use /var/run/mdadm.map for its map file (or
  # /dev/.mdadm/map as a fallback).
  preBuild =
    ''
      makeFlagsArray=(INSTALL=install BINDIR=$out/sbin MANDIR=$out/share/man RUN_DIR=/dev/.mdadm)
      if [[ -n "$crossConfig" ]]; then
        makeFlagsArray+=(CROSS_COMPILE=$crossConfig-)
      fi
    '';

  meta = {
    description = "Programs for managing RAID arrays under Linux";
    homepage = http://neil.brown.name/blog/mdadm;
  };
}

Update path in udev rule of mdadm

{ stdenv, fetchurl, groff }:

stdenv.mkDerivation rec {
  name = "mdadm-3.3";

  src = fetchurl {
    url = "mirror://kernel/linux/utils/raid/mdadm/${name}.tar.bz2";
    sha256 = "0igdqflihiq1dp5qlypzw0xfl44f4n3bckl7r2x2wfgkplcfa1ww";
  };

  nativeBuildInputs = [ groff ];

  preConfigure = "sed -e 's@/lib/udev@\${out}/lib/udev@' -e 's@ -Werror @ @' -i Makefile";

  # Force mdadm to use /var/run/mdadm.map for its map file (or
  # /dev/.mdadm/map as a fallback).
  preBuild =
    ''
      makeFlagsArray=(INSTALL=install BINDIR=$out/sbin MANDIR=$out/share/man RUN_DIR=/dev/.mdadm)
      if [[ -n "$crossConfig" ]]; then
        makeFlagsArray+=(CROSS_COMPILE=$crossConfig-)
      fi
    '';

  preInstall =
    ''
    substituteInPlace udev-md-raid-assembly.rules --replace "/sbin/mdadm" "$out/sbin/mdadm"
    substituteInPlace udev-md-raid-arrays.rules --replace "/sbin/mdadm" "$out/sbin/mdadm"
    '';

  meta = {
    description = "Programs for managing RAID arrays under Linux";
    homepage = http://neil.brown.name/blog/mdadm;
  };
}


{ stdenv, fetchFromGitHub, qmake, pkgconfig
, qtbase, qttools, qtwebkit, sqlite
}:

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

  src = fetchFromGitHub {
    owner = "QuiteRSS";
    repo = "quiterss";
    rev = "${version}";
    sha256 = "0xav9qr8n6310636nfbgx4iix65fs3ya5rz2isxsf38bkjm7r3pa";
  };

  nativeBuildInputs = [ qmake pkgconfig ];
  buildInputs = [ qtbase qttools qtwebkit sqlite.dev ];

  meta = with stdenv.lib; {
    description = "A Qt-based RSS/Atom news feed reader";
    longDescription = ''
      QuiteRSS is a open-source cross-platform RSS/Atom news feeds reader
      written on Qt/C++
    '';
    homepage = https://quiterss.org;
    license = licenses.gpl3;
    platforms = platforms.linux;
    maintainers = with maintainers; [ primeos ];
  };
}

Set QT_PLUGIN_PATH (fixes a few problems)

{ stdenv, fetchFromGitHub, qmake, pkgconfig, makeWrapper
, qtbase, qttools, qtwebkit, sqlite
}:

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

  src = fetchFromGitHub {
    owner = "QuiteRSS";
    repo = "quiterss";
    rev = "${version}";
    sha256 = "0xav9qr8n6310636nfbgx4iix65fs3ya5rz2isxsf38bkjm7r3pa";
  };

  nativeBuildInputs = [ qmake pkgconfig makeWrapper ];
  buildInputs = [ qtbase qttools qtwebkit sqlite.dev ];

  postFixup = ''
    wrapProgram $out/bin/quiterss \
      --prefix QT_PLUGIN_PATH : "${qtbase}/${qtbase.qtPluginPrefix}"
  '';

  meta = with stdenv.lib; {
    description = "A Qt-based RSS/Atom news feed reader";
    longDescription = ''
      QuiteRSS is a open-source cross-platform RSS/Atom news feeds reader
      written on Qt/C++
    '';
    homepage = https://quiterss.org;
    license = licenses.gpl3;
    platforms = platforms.linux;
    maintainers = with maintainers; [ primeos ];
  };
}


{ stdenv, fetchurl, alsaLib, faac, libjack2, lame, libopus, libpulseaudio, libsamplerate, libvorbis }:

with stdenv.lib;

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

  src = fetchurl {
    url = "mirror://sourceforge/darkice/${version}/darkice-${version}.tar.gz";
    sha256 = "0m5jzmja7a9x15zl1634bhxrg3rccph9rkar0rmz6wlw5nzakyxk";
  };

  configureFlags = [
    "--with-alsa-prefix=${alsaLib}"
    "--with-faac-prefix=${faac}"
    "--with-jack-prefix=${libjack2}"
    "--with-lame-prefix=${lame}"
    "--with-opus-prefix=${libopus}"
    "--with-pulseaudio-prefix=${libpulseaudio}"
    "--with-samplerate-prefix=${libsamplerate}"
    "--with-vorbis-prefix=${libvorbis}"
#    "--with-aacplus-prefix=${aacplus}" ### missing: aacplus
#    "--with-twolame-prefix=${twolame}" ### missing: twolame
  ];

  meta = {
    homepage = http://darkice.org/;
    description = "Live audio streamer";
    license = stdenv.lib.licenses.gpl3;
    maintainers = with stdenv.lib.maintainers; [ ikervagyok ];
  };
}

Fix build with opus and vorbis support

{ stdenv, buildEnv, fetchurl, alsaLib, faac, libjack2, lame, libogg, libopus, libpulseaudio, libsamplerate, libvorbis }:

let
  oggEnv = buildEnv {
    name = "env-darkice-ogg";
    paths = [
      libopus libvorbis libogg
    ];
  };

in stdenv.mkDerivation rec {
  name = "darkice-${version}";
  version = "1.2";

  src = fetchurl {
    url = "mirror://sourceforge/darkice/${version}/darkice-${version}.tar.gz";
    sha256 = "0m5jzmja7a9x15zl1634bhxrg3rccph9rkar0rmz6wlw5nzakyxk";
  };

  configureFlags = [
    "--with-alsa-prefix=${alsaLib}"
    "--with-faac-prefix=${faac}"
    "--with-jack-prefix=${libjack2}"
    "--with-lame-prefix=${lame}"
    "--with-opus-prefix=${oggEnv}"
    "--with-pulseaudio-prefix=${libpulseaudio}"
    "--with-samplerate-prefix=${libsamplerate}"
    "--with-vorbis-prefix=${oggEnv}"
#    "--with-aacplus-prefix=${aacplus}" ### missing: aacplus
#    "--with-twolame-prefix=${twolame}" ### missing: twolame
  ];

  meta = {
    homepage = http://darkice.org/;
    description = "Live audio streamer";
    license = stdenv.lib.licenses.gpl3;
    maintainers = with stdenv.lib.maintainers; [ ikervagyok ];
  };
}