diff options
author | Frederik Rietdijk <fridh@fridh.nl> | 2018-12-26 11:57:27 +0100 |
---|---|---|
committer | Frederik Rietdijk <fridh@fridh.nl> | 2018-12-26 11:58:59 +0100 |
commit | 281981a6df9ca93fe7237676757be316ff51e98f (patch) | |
tree | 8e44e300c7021b5ae24fca82890e6f0ff8566b87 /pkgs/development | |
parent | de0de8903f5140e63ed62629f2e9b4b7ead572bd (diff) | |
download | nixpkgs-281981a6df9ca93fe7237676757be316ff51e98f.tar nixpkgs-281981a6df9ca93fe7237676757be316ff51e98f.tar.gz nixpkgs-281981a6df9ca93fe7237676757be316ff51e98f.tar.bz2 nixpkgs-281981a6df9ca93fe7237676757be316ff51e98f.tar.lz nixpkgs-281981a6df9ca93fe7237676757be316ff51e98f.tar.xz nixpkgs-281981a6df9ca93fe7237676757be316ff51e98f.tar.zst nixpkgs-281981a6df9ca93fe7237676757be316ff51e98f.zip |
pywal: move to pythonPackages and inject path to convert
Diffstat (limited to 'pkgs/development')
-rw-r--r-- | pkgs/development/python-modules/pywal/convert.patch | 21 | ||||
-rw-r--r-- | pkgs/development/python-modules/pywal/default.nix | 36 |
2 files changed, 57 insertions, 0 deletions
diff --git a/pkgs/development/python-modules/pywal/convert.patch b/pkgs/development/python-modules/pywal/convert.patch new file mode 100644 index 00000000000..999bc1abeaf --- /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/development/python-modules/pywal/default.nix b/pkgs/development/python-modules/pywal/default.nix new file mode 100644 index 00000000000..799a018e539 --- /dev/null +++ b/pkgs/development/python-modules/pywal/default.nix @@ -0,0 +1,36 @@ +{ lib, python3Packages, imagemagick, feh }: + +python3Packages.buildPythonApplication rec { + pname = "pywal"; + version = "3.2.1"; + + src = python3Packages.fetchPypi { + inherit pname version; + sha256 = "1pj30h19ijwhmbm941yzbkgr19q06dhp9492h9nrqw1wfjfdbdic"; + }; + + # necessary for imagemagick to be found during tests + buildInputs = [ imagemagick ]; + + makeWrapperArgs = [ "--prefix PATH : ${lib.makeBinPath [ imagemagick feh ]}" ]; + + preCheck = '' + mkdir tmp + 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; + license = licenses.mit; + maintainers = with maintainers; [ Fresheyeball ]; + }; +} |