Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 lib, 3 _experimental-update-script-combinators, 4 curl, 5 duktape, 6 fetchFromGitHub, 7 gi-docgen, 8 gitUpdater, 9 glib, 10 gobject-introspection, 11 gsettings-desktop-schemas, 12 makeHardcodeGsettingsPatch, 13 meson, 14 ninja, 15 pkg-config, 16 stdenv, 17 replaceVars, 18 vala, 19 buildPackages, 20 withIntrospection ? 21 lib.meta.availableOn stdenv.hostPlatform gobject-introspection 22 && stdenv.hostPlatform.emulatorAvailable buildPackages, 23}: 24 25stdenv.mkDerivation (finalAttrs: { 26 pname = "libproxy"; 27 version = "0.5.10"; 28 29 outputs = [ 30 "out" 31 "dev" 32 ] 33 ++ lib.optionals withIntrospection [ 34 "devdoc" 35 ]; 36 37 src = fetchFromGitHub { 38 owner = "libproxy"; 39 repo = "libproxy"; 40 rev = finalAttrs.version; 41 hash = "sha256-40GcyH4Oe9xQh9kXe8HohigtCGmIgqFmSV6/j9yolV4="; 42 }; 43 44 patches = [ 45 ] 46 ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [ 47 # Disable schema presence detection, it would fail because it cannot be autopatched, 48 # and it will be hardcoded by the next patch anyway. 49 ./skip-gsettings-detection.patch 50 51 # Hardcode path to Settings schemas for GNOME & related desktops. 52 # Otherwise every app using libproxy would need to be wrapped individually. 53 (replaceVars ./hardcode-gsettings.patch { 54 gds = glib.getSchemaPath gsettings-desktop-schemas; 55 }) 56 ]; 57 58 postPatch = '' 59 # Fix running script that will try to install git hooks. 60 # Though it will not do anything since we do not keep .git/ directory. 61 # https://github.com/libproxy/libproxy/issues/262 62 chmod +x data/install-git-hook.sh 63 patchShebangs data/install-git-hook.sh 64 65 # Fix include-path propagation in non-static builds. 66 # https://github.com/libproxy/libproxy/pull/239#issuecomment-2056620246 67 substituteInPlace src/libproxy/meson.build \ 68 --replace-fail "requires_private: 'gobject-2.0'" "requires: 'gobject-2.0'" 69 ''; 70 71 nativeBuildInputs = [ 72 meson 73 ninja 74 pkg-config 75 ] 76 ++ lib.optionals withIntrospection [ 77 gi-docgen 78 gobject-introspection 79 vala 80 ]; 81 82 buildInputs = [ 83 curl 84 duktape 85 ] 86 ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [ 87 glib 88 gsettings-desktop-schemas 89 ]; 90 91 mesonFlags = [ 92 # Prevent installing commit hook. 93 "-Drelease=true" 94 (lib.mesonBool "docs" withIntrospection) 95 (lib.mesonBool "introspection" withIntrospection) 96 ] 97 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 98 "-Dconfig-gnome=false" 99 ]; 100 101 doCheck = !stdenv.hostPlatform.isDarwin; 102 103 postFixup = '' 104 # Cannot be in postInstall, otherwise _multioutDocs hook in preFixup will move right back. 105 moveToOutput "share/doc" "$devdoc" 106 ''; 107 108 passthru = { 109 hardcodeGsettingsPatch = makeHardcodeGsettingsPatch { 110 schemaIdToVariableMapping = { 111 "org.gnome.system.proxy" = "gds"; 112 "org.gnome.system.proxy.http" = "gds"; 113 "org.gnome.system.proxy.https" = "gds"; 114 "org.gnome.system.proxy.ftp" = "gds"; 115 "org.gnome.system.proxy.socks" = "gds"; 116 }; 117 inherit (finalAttrs) src; 118 }; 119 120 updateScript = 121 let 122 updateSource = gitUpdater { }; 123 updatePatch = _experimental-update-script-combinators.copyAttrOutputToFile "libproxy.hardcodeGsettingsPatch" ./hardcode-gsettings.patch; 124 in 125 _experimental-update-script-combinators.sequence [ 126 updateSource 127 updatePatch 128 ]; 129 }; 130 131 meta = with lib; { 132 description = "Library that provides automatic proxy configuration management"; 133 homepage = "https://libproxy.github.io/libproxy/"; 134 license = licenses.lgpl21Plus; 135 platforms = platforms.linux ++ platforms.darwin; 136 badPlatforms = [ 137 # Mandatory libpxbackend-1.0 shared library. 138 lib.systems.inspect.platformPatterns.isStatic 139 ]; 140 mainProgram = "proxy"; 141 }; 142})