webp-pixbuf-loader: Adopt by GNOME

GNOME uses this for backgrounds so let’s add GNOME team to maintainers
and adopt GNOME coding style aimed at cleaner git diffs:

- Format with `nixpkgs-fmt`
- Inherit `moduleDir` variable since it has the same name
- Avoid re-using `pname` for `src` in case it is overwritten
- Use conventional attribute ordering
- Have one dependency per line in inputs
- Move comments closer to what they describe
- Wrap long substitute line
- Quote bash values

+39 -21
+39 -21
pkgs/development/libraries/webp-pixbuf-loader/default.nix
··· 1 - { lib, stdenv, fetchFromGitHub 2 - , meson, ninja, pkg-config, makeWrapper 3 - , gdk-pixbuf, libwebp 4 }: 5 let 6 - moduleDir = gdk-pixbuf.moduleDir; 7 8 # turning lib/gdk-pixbuf-#.#/#.#.#/loaders into lib/gdk-pixbuf-#.#/#.#.#/loaders.cache 9 # removeSuffix is just in case moduleDir gets a trailing slash ··· 15 16 src = fetchFromGitHub { 17 owner = "aruiz"; 18 - repo = pname; 19 rev = version; 20 sha256 = "sha256-dcdydWYrXZJjo4FxJtvzGzrQLOs87/BmxshFZwsT2ws="; 21 }; 22 23 - # It looks for gdk-pixbuf-thumbnailer in this package's bin rather than the gdk-pixbuf bin. We need to patch that. 24 - postPatch = '' 25 - substituteInPlace webp-pixbuf.thumbnailer.in --replace @bindir@/gdk-pixbuf-thumbnailer $out/bin/webp-thumbnailer 26 - ''; 27 28 - nativeBuildInputs = [ gdk-pixbuf meson ninja pkg-config makeWrapper ]; 29 - buildInputs = [ gdk-pixbuf libwebp ]; 30 31 mesonFlags = [ 32 "-Dgdk_pixbuf_query_loaders_path=${gdk-pixbuf.dev}/bin/gdk-pixbuf-query-loaders" 33 "-Dgdk_pixbuf_moduledir=${placeholder "out"}/${moduleDir}" 34 ]; 35 36 - # It assumes gdk-pixbuf-thumbnailer can find the webp loader in the loaders.cache referenced by environment variable, breaking containment. 37 - # So we replace it with a wrapped executable. 38 - postInstall = '' 39 - mkdir -p $out/bin 40 - makeWrapper ${gdk-pixbuf}/bin/gdk-pixbuf-thumbnailer $out/bin/webp-thumbnailer \ 41 - --set GDK_PIXBUF_MODULE_FILE $out/${loadersPath} 42 ''; 43 44 - # environment variables controlling loaders.cache generation by gdk-pixbuf-query-loaders 45 preInstall = '' 46 - export GDK_PIXBUF_MODULE_FILE=$out/${loadersPath} 47 - export GDK_PIXBUF_MODULEDIR=$out/${moduleDir} 48 ''; 49 50 meta = with lib; { ··· 52 homepage = "https://github.com/aruiz/webp-pixbuf-loader"; 53 license = licenses.lgpl2Plus; 54 platforms = platforms.unix; 55 - maintainers = [ maintainers.cwyc ]; 56 # meson.build:16:0: ERROR: Program or command 'gcc' not found or not executable 57 broken = stdenv.isDarwin; 58 };
··· 1 + { lib 2 + , stdenv 3 + , fetchFromGitHub 4 + , meson 5 + , ninja 6 + , pkg-config 7 + , makeWrapper 8 + , gdk-pixbuf 9 + , libwebp 10 }: 11 + 12 let 13 + inherit (gdk-pixbuf) moduleDir; 14 15 # turning lib/gdk-pixbuf-#.#/#.#.#/loaders into lib/gdk-pixbuf-#.#/#.#.#/loaders.cache 16 # removeSuffix is just in case moduleDir gets a trailing slash ··· 22 23 src = fetchFromGitHub { 24 owner = "aruiz"; 25 + repo = "webp-pixbuf-loader"; 26 rev = version; 27 sha256 = "sha256-dcdydWYrXZJjo4FxJtvzGzrQLOs87/BmxshFZwsT2ws="; 28 }; 29 30 + nativeBuildInputs = [ 31 + gdk-pixbuf 32 + meson 33 + ninja 34 + pkg-config 35 + makeWrapper 36 + ]; 37 38 + buildInputs = [ 39 + gdk-pixbuf 40 + libwebp 41 + ]; 42 43 mesonFlags = [ 44 "-Dgdk_pixbuf_query_loaders_path=${gdk-pixbuf.dev}/bin/gdk-pixbuf-query-loaders" 45 "-Dgdk_pixbuf_moduledir=${placeholder "out"}/${moduleDir}" 46 ]; 47 48 + postPatch = '' 49 + # It looks for gdk-pixbuf-thumbnailer in this package's bin rather than the gdk-pixbuf bin. We need to patch that. 50 + substituteInPlace webp-pixbuf.thumbnailer.in \ 51 + --replace "@bindir@/gdk-pixbuf-thumbnailer" "$out/bin/webp-thumbnailer" 52 ''; 53 54 preInstall = '' 55 + # environment variables controlling loaders.cache generation by gdk-pixbuf-query-loaders 56 + export GDK_PIXBUF_MODULE_FILE="$out/${loadersPath}" 57 + export GDK_PIXBUF_MODULEDIR="$out/${moduleDir}" 58 + ''; 59 + 60 + postInstall = '' 61 + # It assumes gdk-pixbuf-thumbnailer can find the webp loader in the loaders.cache referenced by environment variable, breaking containment. 62 + # So we replace it with a wrapped executable. 63 + mkdir -p "$out/bin" 64 + makeWrapper "${gdk-pixbuf}/bin/gdk-pixbuf-thumbnailer" "$out/bin/webp-thumbnailer" \ 65 + --set GDK_PIXBUF_MODULE_FILE "$out/${loadersPath}" 66 ''; 67 68 meta = with lib; { ··· 70 homepage = "https://github.com/aruiz/webp-pixbuf-loader"; 71 license = licenses.lgpl2Plus; 72 platforms = platforms.unix; 73 + maintainers = teams.gnome.members ++ [ maintainers.cwyc ]; 74 # meson.build:16:0: ERROR: Program or command 'gcc' not found or not executable 75 broken = stdenv.isDarwin; 76 };