diff options
author | obadz <obadz-git@obadz.com> | 2016-08-27 23:54:54 +0100 |
---|---|---|
committer | obadz <obadz-git@obadz.com> | 2016-08-27 23:54:54 +0100 |
commit | 3de6e5be50124834f9d0adfc299295e9e6e30c08 (patch) | |
tree | 31c4c7003ca554e75fa7ead8242f00922a92b25f /pkgs/tools/graphics | |
parent | 132571454c8162cdefe9e94613137d6a13b950b7 (diff) | |
parent | df27c35e9a0515146eb7db07e11af59e520214a6 (diff) | |
download | nixlib-3de6e5be50124834f9d0adfc299295e9e6e30c08.tar nixlib-3de6e5be50124834f9d0adfc299295e9e6e30c08.tar.gz nixlib-3de6e5be50124834f9d0adfc299295e9e6e30c08.tar.bz2 nixlib-3de6e5be50124834f9d0adfc299295e9e6e30c08.tar.lz nixlib-3de6e5be50124834f9d0adfc299295e9e6e30c08.tar.xz nixlib-3de6e5be50124834f9d0adfc299295e9e6e30c08.tar.zst nixlib-3de6e5be50124834f9d0adfc299295e9e6e30c08.zip |
Merge branch 'master' into staging
Conflicts: pkgs/applications/misc/navit/default.nix pkgs/applications/networking/mailreaders/alpine/default.nix pkgs/applications/networking/mailreaders/realpine/default.nix pkgs/development/compilers/ghc/head.nix pkgs/development/libraries/openssl/default.nix pkgs/games/liquidwar/default.nix pkgs/games/spring/springlobby.nix pkgs/os-specific/linux/kernel/perf.nix pkgs/servers/sip/freeswitch/default.nix pkgs/tools/archivers/cromfs/default.nix pkgs/tools/graphics/plotutils/default.nix
Diffstat (limited to 'pkgs/tools/graphics')
-rw-r--r-- | pkgs/tools/graphics/neural-style/default.nix | 57 | ||||
-rw-r--r-- | pkgs/tools/graphics/neural-style/neural-style.sh | 25 | ||||
-rw-r--r-- | pkgs/tools/graphics/plotutils/default.nix | 1 | ||||
-rw-r--r-- | pkgs/tools/graphics/quirc/default.nix | 12 |
4 files changed, 89 insertions, 6 deletions
diff --git a/pkgs/tools/graphics/neural-style/default.nix b/pkgs/tools/graphics/neural-style/default.nix new file mode 100644 index 000000000000..4efa6aa29768 --- /dev/null +++ b/pkgs/tools/graphics/neural-style/default.nix @@ -0,0 +1,57 @@ +{stdenv, fetchFromGitHub, torch, loadcaffe, fetchurl, bash}: +stdenv.mkDerivation rec { + name = "neural-style-${version}"; + version = "0.0pre2016.08.15"; + buildInputs = [torch loadcaffe]; + src = fetchFromGitHub { + owner = "jcjohnson"; + repo = "neural-style"; + rev = "ec5ba3a690d3090428d3b92b0c5d686a311bf432"; + sha256 = "14qzbs9f95izvd0vbbirhymdw9pq2nw0jvhrh7vnyzr99xllwp02"; + }; + models = [ + (fetchurl { + url = "https://gist.githubusercontent.com/ksimonyan/3785162f95cd2d5fee77/raw/bb2b4fe0a9bb0669211cf3d0bc949dfdda173e9e/VGG_ILSVRC_19_layers_deploy.prototxt"; + sha256 = "09cpz7pyvc8sypg2q5j2i8yqwj1sjdbnmd6skl293p9pv13dmjg7"; + }) + (fetchurl { + url = "https://bethgelab.org/media/uploads/deeptextures/vgg_normalised.caffemodel"; + sha256 = "11qckdvlck7wwl3pan0nawgxm8l2ccddi272i5l8rs9qzm7b23rf"; + }) + (fetchurl { + url = "http://www.robots.ox.ac.uk/~vgg/software/very_deep/caffe/VGG_ILSVRC_19_layers.caffemodel"; + sha256 = "0m399x7pl4lnhy435ycsyz8xpzapqmx9n1sz698y2vhcqhkwdd1i"; + }) + ]; + installPhase = '' + mkdir -p "$out"/{bin,lib/lua/neural-style/models,share/doc/neural-style,share/neural-style} + for file in $models; do + cp "$file" "$out/lib/lua/neural-style/models/$(basename "$file" | sed -e 's/[^-]*-//')" + done; + cp README* INSTALL* LICEN?E* "$out"/share/doc/neural-style/ + cp neural_style.lua "$out"/lib/lua/neural-style + + substituteAll "${./neural-style.sh}" "$out/bin/neural-style" + chmod a+x "$out/bin/neural-style" + cp "$out/bin/neural-style" . + cp "$out/lib/lua/neural-style/models/"* models/ + + echo "Testing..." + + "$out/bin/neural-style" -style_image examples/inputs/golden_gate.jpg \ + -content_image examples/inputs/golden_gate.jpg -output_image $PWD/test.png \ + -gpu -1 -save_iter 1 -print_iter 1 -num_iterations 1 || true + + cp -f "$out/lib/lua/neural-style/models/"* models/ + + test -e test.png || exit 1 + ''; + inherit torch bash loadcaffe; + meta = { + inherit version; + description = ''A torch implementation of the paper A Neural Algorithm of Artistic Style''; + license = stdenv.lib.licenses.mit ; + maintainers = [stdenv.lib.maintainers.raskin]; + platforms = stdenv.lib.platforms.linux; + }; +} diff --git a/pkgs/tools/graphics/neural-style/neural-style.sh b/pkgs/tools/graphics/neural-style/neural-style.sh new file mode 100644 index 000000000000..07a4d6dedc04 --- /dev/null +++ b/pkgs/tools/graphics/neural-style/neural-style.sh @@ -0,0 +1,25 @@ +#! @bash@/bin/bash + +declare -a args +c=1 +flag= + +for arg in "$@"; do + if test "$arg" = "${arg#-}" && test "$arg" = "${arg#/}" && test -n "$flag"; then + arg="$PWD/$arg" + flag= + elif test "$arg" != "${arg%_image}" && test "$arg" != "${arg#-}"; then + flag=1 + else + flag= + fi + args[c]="$arg"; + c=$((c+1)); +done + +cd "@out@/lib/lua/neural-style" + +export LUA_PATH="$LUA_PATH${LUA_PATH:+;}@loadcaffe@/lua/?/init.lua;@loadcaffe@/lua/?.lua" +export LUA_CPATH="$LUA_CPATH${LUA_CPATH:+;}@loadcaffe@/lib/?.so" + +@torch@/bin/th neural_style.lua "${args[@]}" diff --git a/pkgs/tools/graphics/plotutils/default.nix b/pkgs/tools/graphics/plotutils/default.nix index 47cf0a60c2f0..c6bde4c5b0c3 100644 --- a/pkgs/tools/graphics/plotutils/default.nix +++ b/pkgs/tools/graphics/plotutils/default.nix @@ -16,6 +16,7 @@ stdenv.mkDerivation rec { buildInputs = [ libpng ]; # disable failing test on i686 + # https://lists.gnu.org/archive/html/bug-plotutils/2016-04/msg00002.html prePatch = stdenv.lib.optionalString stdenv.isi686 '' substituteInPlace test/Makefile.in --replace 'spline.test' ' ' ''; diff --git a/pkgs/tools/graphics/quirc/default.nix b/pkgs/tools/graphics/quirc/default.nix index 2769a9886695..a801dd8ebda9 100644 --- a/pkgs/tools/graphics/quirc/default.nix +++ b/pkgs/tools/graphics/quirc/default.nix @@ -1,17 +1,17 @@ -{stdenv, fetchgit, SDL_gfx, SDL, libjpeg, pkgconfig}: +{stdenv, fetchgit, SDL_gfx, SDL, libjpeg, libpng, pkgconfig}: let s = rec { - date = "2014-11-01"; + date = "2016-08-16"; version = "git-${date}"; baseName = "quirc"; name = "${baseName}-${version}"; url = "https://github.com/dlbeer/quirc"; - rev = "3a3df0d1d6adc59fdc2cadecfaed91650b84cacb"; - sha256 = "1r7jzxl4j93dmky8p5szpcxq7i5f7p1kfrklnzhazlizjc7a2844"; + rev = "5b262480091d5f84a67a4a56c728fc8b39844339"; + sha256 = "1w5qvjafn14s6jjs7kiwsqirlsqbgv0p152hrsq463pm34hp0lzy"; }; buildInputs = [ - SDL SDL_gfx libjpeg pkgconfig + SDL SDL_gfx libjpeg pkgconfig libpng ]; in stdenv.mkDerivation { @@ -20,7 +20,7 @@ stdenv.mkDerivation { src = fetchgit { inherit (s) url sha256 rev; }; - NIX_CFLAGS_COMPILE="-I${SDL.dev}/include/SDL"; + NIX_CFLAGS_COMPILE="-I${SDL.dev}/include/SDL -I${SDL_gfx}/include/SDL"; configurePhase = '' sed -e 's/-[og] root//g' -i Makefile ''; |