5 pkgs ? (import nixpkgs) {},
11 cmake = pkgs.cmake_2_8;
13 xonotic = mkDerivation { pki = true; dp = true; data = true; } rec {
14 name = "xonotic-${version}";
17 src = lib.sourceFilesBySuffices ./. [
26 QCC = "${gmqcc}/bin/gmqcc";
32 # unzip # for downloading maps
40 openssl # for d0_blind_id
61 exe=darkplaces/darkplaces
62 rpath=$(patchelf --print-rpath $exe)
63 rpath_firstparty=$out/d0_blind_id
64 rpath_thirdparty=${lib.makeLibraryPath runtimeInputs}
65 rpath=''${rpath:+$rpath:}$rpath_firstparty:$rpath_thirdparty
66 patchelf --set-rpath $rpath $exe
74 gmqcc = mkDerivation { qcc = true; } rec {
75 name = "gmqcc-${version}";
76 version = "xonotic-${VERSION}";
86 netradiant = mkDerivation { radiant = true; } rec {
87 name = "netradiant-${version}";
126 stdenv = if (cc != null) then overrideCC pkgs.stdenv pkgs."${cc}" else pkgs.stdenv;
127 mkEnableTargets = args: {
128 XON_NO_PKI = !args?pki;
129 XON_NO_DP = !args?dp;
130 XON_NO_DATA = !args?data;
131 XON_NO_QCC = !args?qcc;
132 XON_NO_RADIANT = !args?radiant;
134 mkDerivation = targets: {env ? {}, shellHook ? "", runtimeInputs ? [], ...}@args:
135 stdenv.mkDerivation (
136 (mkEnableTargets targets)
137 // { enableParallelBuilding = true; }
138 // (removeAttrs args ["env" "shellHook" "runtimeInputs"]) # passthru
143 ${lib.concatStringsSep "\n" (lib.mapAttrsToList (n: v: "export ${n}=${v}") env)}
144 export LD_LIBRARY_PATH=''${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}${lib.makeLibraryPath runtimeInputs}
148 shell = let inputs = (lib.mapAttrsToList (n: v: v) targets); in stdenv.mkDerivation (rec {
150 XON_NO_DAEMON = true;
151 nativeBuildInputs = builtins.map (it: it.nativeBuildInputs) inputs;
152 buildInputs = builtins.map (it: it.buildInputs) inputs;
153 shellHook = builtins.map (it: it.shellHook) (builtins.filter (it: it?shellHook) inputs);
155 in { inherit shell; } // targets