gimp: Use env attribute for environment variables

This is in preparation for __structuredAttrs.

+37 -25
+5 -3
pkgs/applications/graphics/gimp/default.nix
··· 154 154 155 155 doCheck = true; 156 156 157 - env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isDarwin "-DGDK_OSX_BIG_SUR=16"; 157 + env = { 158 + NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isDarwin "-DGDK_OSX_BIG_SUR=16"; 158 159 159 - # Check if librsvg was built with --disable-pixbuf-loader. 160 - PKG_CONFIG_GDK_PIXBUF_2_0_GDK_PIXBUF_MODULEDIR = "${librsvg}/${gdk-pixbuf.moduleDir}"; 160 + # Check if librsvg was built with --disable-pixbuf-loader. 161 + PKG_CONFIG_GDK_PIXBUF_2_0_GDK_PIXBUF_MODULEDIR = "${librsvg}/${gdk-pixbuf.moduleDir}"; 162 + }; 161 163 162 164 preConfigure = '' 163 165 # The check runs before glib-networking is registered
+32 -22
pkgs/applications/graphics/gimp/plugins/default.nix
··· 31 31 install -Dt "$pluginDir" "$@" 32 32 } 33 33 ''; 34 - 35 - # Override installation paths. 36 - PKG_CONFIG_GIMP_2_0_GIMPLIBDIR = "${placeholder "out"}/${gimp.targetLibDir}"; 37 - PKG_CONFIG_GIMP_2_0_GIMPDATADIR = "${placeholder "out"}/${gimp.targetDataDir}"; 38 34 } 39 35 // attrs 40 36 // { 41 - name = "${gimp.pname}-plugin-${name}"; 42 - buildInputs = [ 43 - gimp 44 - gimp.gtk 45 - glib 46 - ] ++ (attrs.buildInputs or []); 37 + name = "${gimp.pname}-plugin-${name}"; 38 + buildInputs = [ 39 + gimp 40 + gimp.gtk 41 + glib 42 + ] ++ (attrs.buildInputs or []); 43 + 44 + nativeBuildInputs = [ 45 + pkg-config 46 + intltool 47 + ] ++ (attrs.nativeBuildInputs or []); 47 48 48 - nativeBuildInputs = [ 49 - pkg-config 50 - intltool 51 - ] ++ (attrs.nativeBuildInputs or []); 52 - } 53 - ); 49 + # Override installation paths. 50 + env = { 51 + PKG_CONFIG_GIMP_2_0_GIMPLIBDIR = "${placeholder "out"}/${gimp.targetLibDir}"; 52 + PKG_CONFIG_GIMP_2_0_GIMPDATADIR = "${placeholder "out"}/${gimp.targetDataDir}"; 53 + } // attrs.env or { }; 54 + }); 54 55 55 56 scriptDerivation = {src, ...}@attrs : pluginDerivation ({ 56 57 prePhases = "extraLib"; ··· 116 117 url = "https://ftp.gimp.org/pub/gimp/plug-ins/v2.6/gap/gimp-gap-2.6.0.tar.bz2"; 117 118 sha256 = "1jic7ixcmsn4kx2cn32nc5087rk6g8xsrz022xy11yfmgvhzb0ql"; 118 119 }; 119 - NIX_LDFLAGS = "-lm"; 120 + 120 121 hardeningDisable = [ "format" ]; 122 + 123 + env = { 124 + NIX_LDFLAGS = "-lm"; 125 + }; 126 + 121 127 meta = with lib; { 122 128 description = "The GIMP Animation Package"; 123 129 homepage = "https://www.gimp.org"; ··· 233 239 pname = "wavelet-sharpen"; 234 240 version = "0.1.2"; 235 241 236 - # Workaround build failure on -fno-common toolchains like upstream 237 - # gcc-10. Otherwise build fails as: 238 - # ld: interface.o:(.bss+0xe0): multiple definition of `fimg'; plugin.o:(.bss+0x40): first defined here 239 - env.NIX_CFLAGS_COMPILE = "-fcommon"; 240 - NIX_LDFLAGS = "-lm"; 241 242 src = fetchurl { 242 243 url = "https://github.com/pixlsus/registry.gimp.org_static/raw/master/registry.gimp.org/files/wavelet-sharpen-0.1.2.tar.gz"; 243 244 sha256 = "0vql1k67i21g5ivaa1jh56rg427m0icrkpryrhg75nscpirfxxqw"; 244 245 }; 246 + 247 + env = { 248 + # Workaround build failure on -fno-common toolchains like upstream 249 + # gcc-10. Otherwise build fails as: 250 + # ld: interface.o:(.bss+0xe0): multiple definition of `fimg'; plugin.o:(.bss+0x40): first defined here 251 + NIX_CFLAGS_COMPILE = "-fcommon"; 252 + NIX_LDFLAGS = "-lm"; 253 + }; 254 + 245 255 installPhase = "installPlugin src/wavelet-sharpen"; # TODO translations are not copied .. How to do this on nix? 246 256 }; 247 257