From 563f6880593a138e87d2b1030f2f821bd36bed63 Mon Sep 17 00:00:00 2001
From: Gabriel Ebner <gebner@gebner.org>
Date: Mon, 8 Jan 2018 14:09:53 +0100
Subject: [PATCH] pubs: init at 0.7.0

---
 pkgs/tools/misc/pubs/default.nix | 34 ++++++++++++++++++++++++++++++++
 pkgs/top-level/all-packages.nix  |  2 ++
 2 files changed, 36 insertions(+)
 create mode 100644 pkgs/tools/misc/pubs/default.nix

diff --git a/pkgs/tools/misc/pubs/default.nix b/pkgs/tools/misc/pubs/default.nix
new file mode 100644
index 000000000000..aa8c43b7cdd7
--- /dev/null
+++ b/pkgs/tools/misc/pubs/default.nix
@@ -0,0 +1,34 @@
+{ stdenv, fetchFromGitHub, python3Packages }:
+
+python3Packages.buildPythonApplication rec {
+  name = "pubs-${version}";
+  version = "0.7.0";
+
+  src = fetchFromGitHub {
+    owner = "pubs";
+    repo = "pubs";
+    rev = "v${version}";
+    sha256 = "0n5wbjx9wqy6smfg625mhma739jyg7c92766biaiffp0a2bzr475";
+  };
+
+  propagatedBuildInputs = with python3Packages; [
+    dateutil configobj bibtexparser pyyaml requests beautifulsoup4
+    pyfakefs ddt
+  ];
+
+  preCheck = ''
+    # API tests require networking
+    rm tests/test_apis.py
+
+    # pyfakefs works weirdly in the sandbox
+    export HOME=/
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Command-line bibliography manager";
+    homepage = https://github.com/pubs/pubs;
+    license = licenses.lgpl3;
+    maintainers = with maintainers; [ gebner ];
+    platforms = platforms.all;
+  };
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 36fd29fdac43..d818bc71d88a 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -4175,6 +4175,8 @@ with pkgs;
     libXNVCtrl = linuxPackages.nvidia_x11.settings.libXNVCtrl;
   };
 
+  pubs = callPackage ../tools/misc/pubs {};
+
   pv = callPackage ../tools/misc/pv { };
 
   pwgen = callPackage ../tools/security/pwgen { };