From c9ae8ff6d3e6177fa9e03b9f87c4280cc200a254 Mon Sep 17 00:00:00 2001 From: Sven Slootweg Date: Sun, 17 Jun 2018 16:43:07 +0200 Subject: [PATCH] Initial commit --- build/release.nix | 19 ++++++++ default.nix | 4 ++ pkgs/games/xonotic/default.nix | 88 ++++++++++++++++++++++++++++++++++ 3 files changed, 111 insertions(+) create mode 100644 build/release.nix create mode 100644 default.nix create mode 100644 pkgs/games/xonotic/default.nix diff --git a/build/release.nix b/build/release.nix new file mode 100644 index 0000000..37a2779 --- /dev/null +++ b/build/release.nix @@ -0,0 +1,19 @@ +let + nixpkgs = import ; + + buildPath = path: + {system ? builtins.currentSystem}: + let + nixpkgsWithOverlays = nixpkgs { + inherit system; + overlays = [ + (import ../default.nix) + ]; + }; + in + nixpkgsWithOverlays.lib.getAttr path nixpkgsWithOverlays; + + jobs = rec { + xonotic = buildPath "xonotic"; + }; +in jobs diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..e5f352e --- /dev/null +++ b/default.nix @@ -0,0 +1,4 @@ +self: super: + { + xonotic = super.callPackage ./pkgs/games/xonotic {}; + } diff --git a/pkgs/games/xonotic/default.nix b/pkgs/games/xonotic/default.nix new file mode 100644 index 0000000..7fd5612 --- /dev/null +++ b/pkgs/games/xonotic/default.nix @@ -0,0 +1,88 @@ +{ stdenv, fetchurl +, # required for both + unzip, libjpeg, zlib, libvorbis, curl, patchelf +, # glx + libX11, libGLU_combined, libXpm, libXext, libXxf86vm, alsaLib +, # sdl + SDL2 +}: + +stdenv.mkDerivation rec { + name = "xonotic-0.8.2"; + + src = fetchurl { + url = "http://dl.xonotic.org/${name}.zip"; + sha256 = "1mcs6l4clvn7ibfq3q69k2p0z6ww75rxvnngamdq5ic6yhq74bx2"; + }; + + buildInputs = [ + # required for both + unzip libjpeg + # glx + libX11 libGLU_combined libXpm libXext libXxf86vm alsaLib + # sdl + SDL2 + zlib libvorbis curl + ]; + + sourceRoot = "Xonotic/source/darkplaces"; + + # "debug", "release", "profile" + target = "release"; + + dontStrip = target != "release"; + + buildPhase = '' + DP_FS_BASEDIR="$out/share/xonotic" + make DP_FS_BASEDIR=$DP_FS_BASEDIR cl-${target} + make DP_FS_BASEDIR=$DP_FS_BASEDIR sdl-${target} + make DP_FS_BASEDIR=$DP_FS_BASEDIR sv-${target} + ''; + enableParallelBuilding = true; + + installPhase = '' + mkdir -p "$out/bin" + cp darkplaces-dedicated "$out/bin/xonotic-dedicated" + cp darkplaces-sdl "$out/bin/xonotic-sdl" + cp darkplaces-glx "$out/bin/xonotic-glx" + cd ../.. + mkdir -p "$out/share/xonotic" + mv data "$out/share/xonotic" + + # default to sdl + ln -s "$out/bin/xonotic-sdl" "$out/bin/xonotic" + ''; + + # Xonotic needs to find libcurl.so at runtime for map downloads + dontPatchELF = true; + postFixup = '' + patchelf --add-needed ${curl.out}/lib/libcurl.so $out/bin/xonotic-dedicated + patchelf \ + --add-needed ${curl.out}/lib/libcurl.so \ + --add-needed ${libvorbis}/lib/libvorbisfile.so \ + --add-needed ${libvorbis}/lib/libvorbis.so \ + $out/bin/xonotic-glx + patchelf \ + --add-needed ${curl.out}/lib/libcurl.so \ + --add-needed ${libvorbis}/lib/libvorbisfile.so \ + --add-needed ${libvorbis}/lib/libvorbis.so \ + $out/bin/xonotic-sdl + ''; + + meta = { + description = "A free fast-paced first-person shooter"; + longDescription = '' + Xonotic is a free, fast-paced first-person shooter that works on + Windows, macOS and Linux. The project is geared towards providing + addictive arena shooter gameplay which is all spawned and driven + by the community itself. Xonotic is a direct successor of the + Nexuiz project with years of development between them, and it + aims to become the best possible open-source FPS of its kind. + ''; + homepage = http://www.xonotic.org; + license = stdenv.lib.licenses.gpl2Plus; + maintainers = with stdenv.lib.maintainers; [ astsmtl zalakain ]; + platforms = stdenv.lib.platforms.linux; + hydraPlatforms = []; + }; +}