about summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorFrederik Rietdijk <fridh@fridh.nl>2018-12-26 11:57:27 +0100
committerFrederik Rietdijk <fridh@fridh.nl>2018-12-26 11:58:59 +0100
commit281981a6df9ca93fe7237676757be316ff51e98f (patch)
tree8e44e300c7021b5ae24fca82890e6f0ff8566b87 /pkgs
parentde0de8903f5140e63ed62629f2e9b4b7ead572bd (diff)
downloadnixlib-281981a6df9ca93fe7237676757be316ff51e98f.tar
nixlib-281981a6df9ca93fe7237676757be316ff51e98f.tar.gz
nixlib-281981a6df9ca93fe7237676757be316ff51e98f.tar.bz2
nixlib-281981a6df9ca93fe7237676757be316ff51e98f.tar.lz
nixlib-281981a6df9ca93fe7237676757be316ff51e98f.tar.xz
nixlib-281981a6df9ca93fe7237676757be316ff51e98f.tar.zst
nixlib-281981a6df9ca93fe7237676757be316ff51e98f.zip
pywal: move to pythonPackages and inject path to convert
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/development/python-modules/pywal/convert.patch21
-rw-r--r--pkgs/development/python-modules/pywal/default.nix (renamed from pkgs/tools/graphics/pywal/default.nix)8
-rw-r--r--pkgs/top-level/all-packages.nix2
-rw-r--r--pkgs/top-level/python-packages.nix2
4 files changed, 32 insertions, 1 deletions
diff --git a/pkgs/development/python-modules/pywal/convert.patch b/pkgs/development/python-modules/pywal/convert.patch
new file mode 100644
index 000000000000..999bc1abeaf1
--- /dev/null
+++ b/pkgs/development/python-modules/pywal/convert.patch
@@ -0,0 +1,21 @@
+diff --git a/pywal/backends/wal.py b/pywal/backends/wal.py
+index a75fdc5..4339680 100644
+--- a/pywal/backends/wal.py
++++ b/pywal/backends/wal.py
+@@ -21,15 +21,7 @@ def imagemagick(color_count, img, magick_command):
+
+ def has_im():
+     """Check to see if the user has im installed."""
+-    if shutil.which("magick"):
+-        return ["magick", "convert"]
+-
+-    if shutil.which("convert"):
+-        return ["convert"]
+-
+-    logging.error("Imagemagick wasn't found on your system.")
+-    logging.error("Try another backend. (wal --backend)")
+-    sys.exit(1)
++    return ["@convert@"]
+
+
+ def gen_colors(img):
diff --git a/pkgs/tools/graphics/pywal/default.nix b/pkgs/development/python-modules/pywal/default.nix
index 4d493bdd73eb..799a018e5392 100644
--- a/pkgs/tools/graphics/pywal/default.nix
+++ b/pkgs/development/python-modules/pywal/default.nix
@@ -19,6 +19,14 @@ python3Packages.buildPythonApplication rec {
     HOME=$PWD/tmp
   '';
 
+  patches = [
+    ./convert.patch
+  ];
+
+  postPatch = ''
+    substituteInPlace pywal/backends/wal.py --subst-var-by convert "${imagemagick}/bin/convert"
+  '';
+
   meta = with lib; {
     description = "Generate and change colorschemes on the fly. A 'wal' rewrite in Python 3.";
     homepage = https://github.com/dylanaraps/pywal;
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index dbf1c2e4e39d..9f9e963caac3 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -5017,7 +5017,7 @@ in
 
   pytrainer = callPackage ../applications/misc/pytrainer { };
 
-  pywal = callPackage ../tools/graphics/pywal {};
+  pywal = with python3Packages; toPythonApplication pywal;
 
   remarshal = callPackage ../development/tools/remarshal { };
 
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index d3e384d8ed26..a377046c990b 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -3733,6 +3733,8 @@ in {
 
   pyutil = callPackage ../development/python-modules/pyutil { };
 
+  pywal = callPackage ../development/python-modules/pywal { };
+
   pywebkitgtk = callPackage ../development/python-modules/pywebkitgtk { };
 
   pywinrm = callPackage ../development/python-modules/pywinrm { };