Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 stdenv, 3 lib, 4 makeWrapper, 5 wrapGAppsHook3, 6 autoPatchelfHook, 7 dpkg, 8 xorg, 9 atk, 10 glib, 11 pango, 12 gdk-pixbuf, 13 cairo, 14 freetype, 15 fontconfig, 16 gtk3, 17 dbus, 18 nss, 19 nspr, 20 alsa-lib, 21 cups, 22 expat, 23 udev, 24 libnotify, 25 xdg-utils, 26 libgbm, 27 libglvnd, 28 libappindicator-gtk3, 29}: 30 31# Helper function for building a derivation for Franz and forks. 32 33{ 34 pname, 35 name, 36 version, 37 src, 38 meta, 39 extraBuildInputs ? [ ], 40 ... 41}@args: 42let 43 cleanedArgs = builtins.removeAttrs args [ 44 "pname" 45 "name" 46 "version" 47 "src" 48 "meta" 49 "extraBuildInputs" 50 ]; 51in 52stdenv.mkDerivation ( 53 rec { 54 inherit 55 pname 56 version 57 src 58 meta 59 ; 60 61 # Don't remove runtime deps. 62 dontPatchELF = true; 63 64 nativeBuildInputs = [ 65 autoPatchelfHook 66 makeWrapper 67 wrapGAppsHook3 68 dpkg 69 ]; 70 buildInputs = 71 extraBuildInputs 72 ++ (with xorg; [ 73 libXi 74 libXcursor 75 libXdamage 76 libXrandr 77 libXcomposite 78 libXext 79 libXfixes 80 libXrender 81 libX11 82 libXtst 83 libXScrnSaver 84 ]) 85 ++ [ 86 libgbm 87 gtk3 88 atk 89 glib 90 pango 91 gdk-pixbuf 92 cairo 93 freetype 94 fontconfig 95 dbus 96 nss 97 nspr 98 alsa-lib 99 cups 100 expat 101 stdenv.cc.cc 102 ]; 103 runtimeDependencies = [ 104 libglvnd 105 (lib.getLib stdenv.cc.cc) 106 (lib.getLib udev) 107 libnotify 108 libappindicator-gtk3 109 ]; 110 111 installPhase = '' 112 mkdir -p $out/bin 113 cp -r opt $out 114 ln -s $out/opt/${name}/${pname} $out/bin 115 116 # Provide desktop item and icon. 117 cp -r usr/share $out 118 substituteInPlace $out/share/applications/${pname}.desktop \ 119 --replace /opt/${name}/${pname} ${pname} 120 ''; 121 122 dontWrapGApps = true; 123 124 postFixup = '' 125 # make xdg-open overridable at runtime 126 wrapProgramShell $out/opt/${name}/${pname} \ 127 --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath runtimeDependencies}" \ 128 --suffix PATH : ${xdg-utils}/bin \ 129 --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations,WebRTCPipeWireCapturer --enable-wayland-ime=true}}" \ 130 "''${gappsWrapperArgs[@]}" 131 ''; 132 } 133 // cleanedArgs 134)