Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 101 lines 1.8 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchFromGitLab, 5 pkg-config, 6 xfce4-dev-tools, 7 hicolor-icon-theme, 8 xfce, 9 wrapGAppsHook3, 10 gitUpdater, 11}: 12 13{ 14 category, 15 pname, 16 version, 17 attrPath ? "xfce.${pname}", 18 rev-prefix ? "${pname}-", 19 rev ? "${rev-prefix}${version}", 20 sha256, 21 odd-unstable ? true, 22 patchlevel-unstable ? true, 23 passthru ? { }, 24 meta ? { }, 25 ... 26}@args: 27 28let 29 inherit (builtins) 30 filter 31 getAttr 32 head 33 isList 34 ; 35 inherit (lib) 36 attrNames 37 concatLists 38 recursiveUpdate 39 zipAttrsWithNames 40 ; 41 42 filterAttrNames = f: attrs: filter (n: f (getAttr n attrs)) (attrNames attrs); 43 44 concatAttrLists = 45 attrsets: zipAttrsWithNames (filterAttrNames isList (head attrsets)) (_: concatLists) attrsets; 46 47 template = { 48 nativeBuildInputs = [ 49 pkg-config 50 xfce4-dev-tools 51 wrapGAppsHook3 52 ]; 53 buildInputs = [ hicolor-icon-theme ]; 54 configureFlags = [ "--enable-maintainer-mode" ]; 55 56 src = fetchFromGitLab { 57 domain = "gitlab.xfce.org"; 58 owner = category; 59 repo = pname; 60 inherit rev sha256; 61 }; 62 63 enableParallelBuilding = true; 64 outputs = [ 65 "out" 66 "dev" 67 ]; 68 69 pos = builtins.unsafeGetAttrPos "pname" args; 70 71 passthru = { 72 updateScript = gitUpdater { 73 inherit rev-prefix odd-unstable patchlevel-unstable; 74 }; 75 } 76 // passthru; 77 78 meta = 79 with lib; 80 { 81 homepage = "https://gitlab.xfce.org/${category}/${pname}"; 82 license = licenses.gpl2Plus; # some libraries are under LGPLv2+ 83 platforms = platforms.linux; 84 } 85 // meta; 86 }; 87 88 publicArgs = removeAttrs args [ 89 "category" 90 "sha256" 91 ]; 92in 93 94stdenv.mkDerivation ( 95 publicArgs 96 // template 97 // concatAttrLists [ 98 template 99 args 100 ] 101)