diff options
Diffstat (limited to 'pkgs/games')
34 files changed, 775 insertions, 433 deletions
diff --git a/pkgs/games/0ad/default.nix b/pkgs/games/0ad/default.nix index f9eb90f34f8..e854af58865 100644 --- a/pkgs/games/0ad/default.nix +++ b/pkgs/games/0ad/default.nix @@ -109,7 +109,7 @@ stdenv.mkDerivation rec { mkdir -p "$out"/share/applications while read LINE; do if [[ $LINE = "Exec=0ad" ]]; then - echo "Exec=$out/bin/pyrogenesis" + echo "Exec=$out/bin/zeroad" elif [[ $LINE = "Icon=0ad" ]]; then echo "Icon=$out/share/icons/0ad.png" else @@ -126,5 +126,6 @@ stdenv.mkDerivation rec { licenses.zlib # otherwise masked by pkgs.zlib ]; platforms = [ "x86_64-linux" "i686-linux" ]; + hydraPlatforms = []; # the data are too big (~1.5 GB) }; } diff --git a/pkgs/games/2048-in-terminal/default.nix b/pkgs/games/2048-in-terminal/default.nix index cbf6a19b319..30e930c294a 100644 --- a/pkgs/games/2048-in-terminal/default.nix +++ b/pkgs/games/2048-in-terminal/default.nix @@ -1,8 +1,8 @@ { stdenv, fetchFromGitHub, ncurses }: -let version = "2015-01-15"; in stdenv.mkDerivation rec { name = "2048-in-terminal-${version}"; + version = "2015-01-15"; src = fetchFromGitHub { sha256 = "1fdfmyhh60sz0xbilxkh2y09lvbcs9lamk2jkjkhxhlhxknmnfgs"; @@ -21,7 +21,6 @@ stdenv.mkDerivation rec { installFlags = [ "DESTDIR=$(out)" ]; meta = with stdenv.lib; { - inherit version; inherit (src.meta) homepage; description = "Animated console version of the 2048 game"; license = licenses.mit; diff --git a/pkgs/games/dfhack/default.nix b/pkgs/games/dfhack/default.nix deleted file mode 100644 index 046f11545a5..00000000000 --- a/pkgs/games/dfhack/default.nix +++ /dev/null @@ -1,62 +0,0 @@ -{ stdenv, fetchgit, dwarf_fortress, cmake, zlib, perl, XMLLibXML, XMLLibXSLT -}: - -let - baseVersion = "40"; - patchVersion = "24-r3"; - src = fetchgit { - url = "https://github.com/DFHack/dfhack.git"; - rev = "0849099f2083e100cae6f64940b4eff4c28ce2eb"; - sha256 = "0lnqrayi8hwfivkrxb7fw8lb6v95i04pskny1px7084n7nzvyv8b"; - }; - -in - -assert stdenv.system == "i686-linux"; -assert dwarf_fortress.name == "dwarf-fortress-0.40.24"; - -stdenv.mkDerivation rec { - name = "dfhack-0.${baseVersion}.${patchVersion}"; - - inherit baseVersion patchVersion src; - - buildInputs = [ cmake zlib perl XMLLibXML XMLLibXSLT ]; - - preConfigure = '' - export cmakeFlags="-DCMAKE_INSTALL_PREFIX=$prefix/dfhack $cmakeFlags" - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:`pwd`/build/depends/protobuf - ''; - - installPhase = '' - mkdir -p $out/dfhack - make install - cp ../package/linux/dfhack $out/dfhack/ - mkdir -p $out/bin - cat > $out/bin/dfhack_install_dir <<EOF - #!/bin/sh - test -z "\$1" && echo "This creates a Dwarf Fortress/DFHack game directory. Please specify a directory (preferably empty or non-existent) for this." && exit 1 - - set -e - mkdir -p "\$1" - cd "\$1" - cp -r ${dwarf_fortress}/share/df_linux/* . - cp -r $out/dfhack/* . - chmod -R u+w . - # use LD_LIBRARY_PATH setting from dwarf-fortress wrapper - sed -e 's%# Now run%`grep LD_LIBRARY_PATH ${dwarf_fortress}/bin/dwarf-fortress`%' $out/dfhack/dfhack > dfhack - # write md5sum of binary - sed -e s/c42f55948a448645d6609102ef6439e8/`md5sum ${dwarf_fortress}/share/df_linux/libs/Dwarf_Fortress | cut -f1 -d\ `/ $out/dfhack/hack/symbols.xml > hack/symbols.xml - - echo "DFHack installed successfully in \$1. To play, run ./dfhack in it." - - EOF - chmod +x $out/bin/dfhack_install_dir - ''; - - meta = { - description = "A Dwarf Fortress memory access library"; - homepage = https://github.com/DFHack/dfhack; - license = stdenv.lib.licenses.bsd2; - maintainers = with stdenv.lib.maintainers; [ robbinch ]; - }; -} diff --git a/pkgs/games/dwarf-fortress/default.nix b/pkgs/games/dwarf-fortress/default.nix index 97c793b8a39..d91c110c34c 100644 --- a/pkgs/games/dwarf-fortress/default.nix +++ b/pkgs/games/dwarf-fortress/default.nix @@ -1,218 +1,33 @@ -{ stdenv, fetchgit, fetchurl, cmake, glew, ncurses -, SDL, SDL_image, SDL_ttf, gtk2, glib -, mesa, openal, pango, atk, gdk_pixbuf, glibc, libsndfile -# begin dfhack-only parameters -, XMLLibXML -, XMLLibXSLT -, perl -, zlib -# end dfhack-only parameters -, enableDFHack ? false -}: +{ pkgs, pkgsi686Linux }: let - baseVersion = "40"; - patchVersion = "24"; - srcs = { - df_unfuck = fetchgit { - url = "https://github.com/svenstaro/dwarf_fortress_unfuck"; - rev = "39742d64d2886fb594d79e7cc4b98fb917f26811"; - sha256 = "19vwx6kpv1sf93bx5v8x47f7x2cgxsqk82v6j1a72sa3q7m5cpc7"; - }; + callPackage = pkgs.newScope self; + callPackage_i686 = pkgsi686Linux.newScope self; - dfhack = fetchgit { - url = "https://github.com/DFHack/dfhack.git"; - rev = "0849099f2083e100cae6f64940b4eff4c28ce2eb"; - sha256 = "0lnqrayi8hwfivkrxb7fw8lb6v95i04pskny1px7084n7nzvyv8b"; - }; + self = rec { + dwarf-fortress-original = callPackage_i686 ./game.nix { }; - df = fetchurl { - url = "http://www.bay12games.com/dwarves/df_${baseVersion}_${patchVersion}_linux.tar.bz2"; - sha256 = "0d4jrs45qj89vq9mjg7fxxhis7zivvb0vzjpmkk274b778kccdys"; + dfhack = callPackage_i686 ./dfhack { + inherit (pkgsi686Linux.perlPackages) XMLLibXML XMLLibXSLT; }; - }; - - dfHackWorksWithCurrentVersion = true; - dfHackEnabled = dfHackWorksWithCurrentVersion && enableDFHack; - -in - -assert stdenv.system == "i686-linux"; - -stdenv.mkDerivation rec { - name = "dwarf-fortress-0.${baseVersion}.${patchVersion}"; - - inherit baseVersion patchVersion; - - buildInputs = [ - SDL - SDL_image - SDL_ttf - gtk2 - glib - glew - mesa - ncurses - openal - glibc - libsndfile - pango - atk - cmake - gdk_pixbuf - XMLLibXML - XMLLibXSLT - perl - zlib - ]; - src = "${srcs.df_unfuck} ${srcs.df}" + stdenv.lib.optionalString dfHackEnabled " ${srcs.dfhack}"; - - sourceRoot = srcs.df_unfuck.name; - dfHackSourceRoot = srcs.dfhack.name; - - cmakeFlags = [ - "-DGTK2_GLIBCONFIG_INCLUDE_DIR=${glib.out}/lib/glib-2.0/include" - "-DGTK2_GDKCONFIG_INCLUDE_DIR=${gtk2.out}/lib/gtk-2.0/include" - ]; - - permission = ./df_permission; - dfHackTemplate = ./dwarf-fortress-hacked.in; - dfHackRunTemplate = ./dfhack-run.in; - dwarfFortressTemplate = ./dwarf-fortress.in; - installDfDataToHome = ./install-df-data-to-home.sh; - installDfhackDataToHome = ./install-dfhack-data-to-home.sh; - installDfDataContentToHome = ./install-df-data-content-to-home.sh; - exportLibsTemplate = ./export-libs.sh.in; - exportWorkaround = ./export-workaround.sh; - - postUnpack = stdenv.lib.optionalString dfHackEnabled '' - if [ "$dontMakeSourcesWritable" != 1 ]; then - chmod -R u+w "$dfHackSourceRoot" - fi - ''; - - preConfigure = stdenv.lib.optionalString dfHackEnabled '' - export cmakeFlags="-DCMAKE_INSTALL_PREFIX=$out/share/df_linux $cmakeFlags" - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(pwd)/build/depends/protobuf - ''; - - postConfigure = stdenv.lib.optionalString dfHackEnabled '' - if [ -z "$originalSourceRoot" ]; then - - originalSourceRoot=$sourceRoot - export sourceRoot=$dfHackSourceRoot - - pushd ../../$sourceRoot - - eval "''${configurePhase:-configurePhase}" - - popd - - export sourceRoot=$originalSourceRoot - unset originalSourceRoot - fi - ''; - - # outputs TODO: probably wrong path-substitutions below - installPhase = '' - set -x - mkdir -p $out/bin - mkdir -p $out/share/df_linux - pushd ../../ - cp -r ./df_linux/* $out/share/df_linux - rm $out/share/df_linux/libs/lib* - # Store the original hash - orig_hash=$(md5sum $out/share/df_linux/libs/Dwarf_Fortress | awk '{ print $1 }') - echo $orig_hash | cut -c1-8 > $out/share/df_linux/hash.md5.orig # for dwarf-therapist - echo $orig_hash > $out/share/df_linux/full-hash-orig.md5 # for dfhack + dwarf-fortress-unfuck = callPackage_i686 ./unfuck.nix { }; - cp -f ./${srcs.df_unfuck.name}/build/libgraphics.so $out/share/df_linux/libs/libgraphics.so - - cp $permission $out/share/df_linux/nix_permission - - # Placeholder files for hashes of patched binary - touch $out/share/df_linux/hash.md5.patched - touch $out/share/df_linux/full-hash-patched.md5 - - mkdir -p $out/share/df_linux/shell - cp $installDfDataToHome $out/share/df_linux/shell/install-df-data-to-home.sh - cp $installDfhackDataToHome $out/share/df_linux/shell/install-dfhack-data-to-home.sh - cp $installDfDataContentToHome $out/share/df_linux/shell/install-df-data-content-to-home.sh - cp $exportWorkaround $out/share/df_linux/shell/export-workaround.sh - substitute $exportLibsTemplate $out/share/df_linux/shell/export-libs.sh \ - --subst-var-by stdenv_cc ${stdenv.cc} \ - --subst-var-by SDL ${SDL} \ - --subst-var-by SDL_image ${SDL_image} \ - --subst-var-by SDL_ttf ${SDL_ttf} \ - --subst-var-by gtk2 ${gtk2} \ - --subst-var-by glib ${glib} \ - --subst-var-by libsndfile ${libsndfile} \ - --subst-var-by mesa ${mesa} \ - --subst-var-by openal ${openal} \ - --subst-var-by zlib ${zlib} \ - - substitute $dwarfFortressTemplate $out/bin/dwarf-fortress \ - --subst-var-by stdenv_shell ${stdenv.shell} \ - --subst-var prefix - - chmod 755 $out/bin/dwarf-fortress - - popd - '' + stdenv.lib.optionalString dfHackEnabled '' - - originalSourceRoot=$sourceRoot - export sourceRoot=$dfHackSourceRoot - - pushd ../../$sourceRoot/build - - mkdir -p $out/dfhack - - make install - - cp ../package/linux/dfhack $out/dfhack/ - - mkdir -p $out/bin - - substitute $dfHackTemplate $out/bin/dfhack \ - --subst-var-by stdenv_shell ${stdenv.shell} \ - --subst-var prefix - chmod 755 $out/bin/dfhack - - substitute $dfHackRunTemplate $out/bin/dfhack-run \ - --subst-var-by stdenv_shell ${stdenv.shell} \ - --subst-var prefix - chmod 755 $out/bin/dfhack-run - - popd - - export sourceRoot=$originalSourceRoot - unset originalSourceRoot - ''; - - fixupPhase = '' - # Fix rpath - patchelf --set-rpath "${stdenv.lib.makeLibraryPath [ stdenv.cc.cc stdenv.glibc ]}:$out/share/df_linux/libs" $out/share/df_linux/libs/Dwarf_Fortress - - patchelf --set-interpreter ${glibc.out}/lib/ld-linux.so.2 $out/share/df_linux/libs/Dwarf_Fortress + dwarf-fortress = callPackage ./wrapper { + themes = { + "phoebus" = phoebus-theme; + }; + }; - # Store new hash - patched_hash=$(md5sum $out/share/df_linux/libs/Dwarf_Fortress | awk '{ print $1 }') - echo $patched_hash | cut -c1-8 > $out/share/df_linux/hash.md5.patched # for dwarf-therapist - echo $patched_hash > $out/share/df_linux/full-hash-patched.md5 # for dfhack - '' + stdenv.lib.optionalString dfHackEnabled '' - find $out/share/df_linux/hack \( \ - \( -type f -a -name "*.so*" \) -o \ - \( -type f -a -perm +0100 \) \ - \) -print -exec patchelf --shrink-rpath {} \; + dwarf-therapist-original = callPackage ./dwarf-therapist { + texlive = pkgs.texlive.combine { + inherit (pkgs.texlive) scheme-basic float caption wrapfig adjmulticol sidecap preprint enumitem; + }; + }; - sed -i "s/$(cat $out/share/df_linux/full-hash-orig.md5)/$(cat $out/share/df_linux/full-hash-patched.md5)/" $out/share/df_linux/hack/symbols.xml - ''; + dwarf-therapist = callPackage ./dwarf-therapist/wrapper.nix { }; - meta = { - description = "A single-player fantasy game with a randomly generated adventure world"; - homepage = http://www.bay12games.com/dwarves; - license = stdenv.lib.licenses.unfreeRedistributable; - maintainers = with stdenv.lib.maintainers; [ a1russell robbinch roconnor the-kenny ]; + phoebus-theme = callPackage ./themes/phoebus.nix { }; }; -} + +in self diff --git a/pkgs/games/dwarf-fortress/dfhack-run.in b/pkgs/games/dwarf-fortress/dfhack-run.in deleted file mode 100644 index 590e5b25acf..00000000000 --- a/pkgs/games/dwarf-fortress/dfhack-run.in +++ /dev/null @@ -1,11 +0,0 @@ -#!@stdenv_shell@ - -data_dir=${XDG_DATA_HOME:-$HOME/.local/share}/df_linux -pkg_dir=@prefix@/share/df_linux - -. $pkg_dir/shell/install-df-data-to-home.sh -. $pkg_dir/shell/install-dfhack-data-to-home.sh -. $pkg_dir/shell/export-libs.sh - -cd "$data_dir" -exec ./dfhack-run "$@" diff --git a/pkgs/games/dwarf-fortress/dfhack/default.nix b/pkgs/games/dwarf-fortress/dfhack/default.nix new file mode 100644 index 00000000000..92b9d57da42 --- /dev/null +++ b/pkgs/games/dwarf-fortress/dfhack/default.nix @@ -0,0 +1,49 @@ +{ stdenv, fetchgit, cmake, writeScriptBin +, perl, XMLLibXML, XMLLibXSLT +, zlib +, jsoncpp, protobuf, tinyxml +}: + +let + rev = "f61ff9147e00f3c379ac0458e79eb556a5de1b68"; + dfVersion = "0.42.05"; + + fakegit = writeScriptBin "git" '' + #! ${stdenv.shell} + if [ "$*" = "describe --tags --long" ]; then + echo "${dfVersion}-unknown" + elif [ "$*" = "rev-parse HEAD" ]; then + echo "${rev}" + else + exit 1 + fi + ''; + +in stdenv.mkDerivation { + name = "dfhack-20160118"; + + # Beware of submodules + src = fetchgit { + url = "https://github.com/DFHack/dfhack"; + inherit rev; + sha256 = "1ah3cplp4mb9pq7rm1cmn8klfjxw3y2xfzy7734i81b3iwiwlpi4"; + }; + + patches = [ ./use-system-libraries.patch ]; + + nativeBuildInputs = [ cmake perl XMLLibXML XMLLibXSLT fakegit ]; + # we can't use native Lua; upstream uses private headers + buildInputs = [ zlib jsoncpp protobuf tinyxml ]; + + enableParallelBuilding = true; + + passthru = { inherit dfVersion; }; + + meta = with stdenv.lib; { + description = "Memory hacking library for Dwarf Fortress and a set of tools that use it"; + homepage = https://github.com/DFHack/dfhack/; + license = licenses.zlib; + platforms = [ "i686-linux" ]; + maintainers = with maintainers; [ robbinch a1russell abbradar ]; + }; +} diff --git a/pkgs/games/dwarf-fortress/dfhack/use-system-libraries.patch b/pkgs/games/dwarf-fortress/dfhack/use-system-libraries.patch new file mode 100644 index 00000000000..2ae3620fff6 --- /dev/null +++ b/pkgs/games/dwarf-fortress/dfhack/use-system-libraries.patch @@ -0,0 +1,138 @@ +From 1196fcb987b6aadb49075d817b3615bf8a6d7d51 Mon Sep 17 00:00:00 2001 +From: Nikolay Amiantov <ab@fmap.me> +Date: Wed, 6 Jan 2016 03:07:20 +0300 +Subject: [PATCH 2/2] Use as much system libraries as possible + +--- + CMakeLists.txt | 5 ----- + depends/CMakeLists.txt | 3 --- + library/CMakeLists.txt | 10 +++++----- + plugins/CMakeLists.txt | 4 ++-- + plugins/mapexport/CMakeLists.txt | 4 ++-- + plugins/stockpiles/CMakeLists.txt | 4 ++-- + 6 files changed, 11 insertions(+), 19 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 1933390..d871df4 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -152,8 +152,6 @@ ELSEIF(MSVC) + SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /Od") + ENDIF() + +-# use shared libraries for protobuf +-ADD_DEFINITIONS(-DPROTOBUF_USE_DLLS) + ADD_DEFINITIONS(-DLUA_BUILD_AS_DLL) + + if(APPLE) +@@ -173,11 +171,8 @@ if(NOT UNIX) + endif() + set(ZLIB_ROOT /usr/lib/i386-linux-gnu) + find_package(ZLIB REQUIRED) +-include_directories(depends/protobuf) + include_directories(depends/lua/include) + include_directories(depends/md5) +-include_directories(depends/jsoncpp) +-include_directories(depends/tinyxml) + include_directories(depends/tthread) + include_directories(${ZLIB_INCLUDE_DIRS}) + include_directories(depends/clsocket/src) +diff --git a/depends/CMakeLists.txt b/depends/CMakeLists.txt +index bf0345b..2a1a852 100644 +--- a/depends/CMakeLists.txt ++++ b/depends/CMakeLists.txt +@@ -1,10 +1,7 @@ + #list depends here. + add_subdirectory(lua) + add_subdirectory(md5) +-add_subdirectory(protobuf) +-add_subdirectory(tinyxml) + add_subdirectory(tthread) +-add_subdirectory(jsoncpp) + # build clsocket static and only as a dependency. Setting those options here overrides its own default settings. + OPTION(CLSOCKET_SHARED "Build clsocket lib as shared." OFF) + OPTION(CLSOCKET_DEP_ONLY "Build for use inside other CMake projects as dependency." ON) +diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt +index 5071d9e..d346d1e 100644 +--- a/library/CMakeLists.txt ++++ b/library/CMakeLists.txt +@@ -203,10 +203,10 @@ LIST(APPEND PROJECT_SOURCES ${PROJECT_PROTO_SRCS}) + + ADD_CUSTOM_COMMAND( + OUTPUT ${PROJECT_PROTO_SRCS} ${PROJECT_PROTO_HDRS} +- COMMAND protoc-bin -I=${CMAKE_CURRENT_SOURCE_DIR}/proto/ ++ COMMAND protoc -I=${CMAKE_CURRENT_SOURCE_DIR}/proto/ + --cpp_out=dllexport_decl=DFHACK_EXPORT:${CMAKE_CURRENT_SOURCE_DIR}/proto/ + ${PROJECT_PROTOS} +- DEPENDS protoc-bin ${PROJECT_PROTOS} ++ DEPENDS ${PROJECT_PROTOS} + ) + + # Merge headers into sources +@@ -249,12 +249,12 @@ IF(UNIX) + ENDIF() + + IF(APPLE) +- SET(PROJECT_LIBS dl dfhack-md5 dfhack-tinyxml dfhack-tinythread) ++ SET(PROJECT_LIBS dl dfhack-md5 tinyxml dfhack-tinythread) + ELSEIF(UNIX) +- SET(PROJECT_LIBS rt dl dfhack-md5 dfhack-tinyxml dfhack-tinythread) ++ SET(PROJECT_LIBS rt dl dfhack-md5 tinyxml dfhack-tinythread) + ELSE(WIN32) + #FIXME: do we really need psapi? +- SET(PROJECT_LIBS psapi dfhack-md5 dfhack-tinyxml dfhack-tinythread) ++ SET(PROJECT_LIBS psapi dfhack-md5 tinyxml dfhack-tinythread) + ENDIF() + + ADD_LIBRARY(dfhack-version STATIC DFHackVersion.cpp) +diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt +index 9781401..ece508c 100644 +--- a/plugins/CMakeLists.txt ++++ b/plugins/CMakeLists.txt +@@ -69,11 +69,11 @@ STRING(REPLACE ".proto" ".pb.h" PROJECT_PROTO_HDRS "${PROJECT_PROTOS}") + + ADD_CUSTOM_COMMAND( + OUTPUT ${PROJECT_PROTO_SRCS} ${PROJECT_PROTO_HDRS} +- COMMAND protoc-bin -I=${dfhack_SOURCE_DIR}/library/proto/ ++ COMMAND protoc -I=${dfhack_SOURCE_DIR}/library/proto/ + -I=${CMAKE_CURRENT_SOURCE_DIR}/proto/ + --cpp_out=${CMAKE_CURRENT_SOURCE_DIR}/proto/ + ${PROJECT_PROTOS} +- DEPENDS protoc-bin ${PROJECT_PROTOS} ++ DEPENDS ${PROJECT_PROTOS} + ) + add_custom_target(generate_proto DEPENDS ${PROJECT_PROTO_SRCS} ${PROJECT_PROTO_HDRS}) + +diff --git a/plugins/mapexport/CMakeLists.txt b/plugins/mapexport/CMakeLists.txt +index 429507a..7e2390a 100644 +--- a/plugins/mapexport/CMakeLists.txt ++++ b/plugins/mapexport/CMakeLists.txt +@@ -32,8 +32,8 @@ LIST(APPEND PROJECT_SRCS ${PROJECT_HDRS}) + #Generate sources from our proto files and store them in the source tree + ADD_CUSTOM_COMMAND( + OUTPUT ${PROJECT_PROTO_SRCS} ${PROJECT_PROTO_HDRS} +-COMMAND protoc-bin -I=${CMAKE_CURRENT_SOURCE_DIR}/proto/ --cpp_out=${CMAKE_CURRENT_SOURCE_DIR}/proto/ ${PROJECT_PROTOS} +-DEPENDS protoc-bin ${PROJECT_PROTOS} ++COMMAND protoc -I=${CMAKE_CURRENT_SOURCE_DIR}/proto/ --cpp_out=${CMAKE_CURRENT_SOURCE_DIR}/proto/ ${PROJECT_PROTOS} ++DEPENDS ${PROJECT_PROTOS} + ) + + IF(WIN32) +diff --git a/plugins/stockpiles/CMakeLists.txt b/plugins/stockpiles/CMakeLists.txt +index 713c3d6..dd2d4cb 100644 +--- a/plugins/stockpiles/CMakeLists.txt ++++ b/plugins/stockpiles/CMakeLists.txt +@@ -33,8 +33,8 @@ LIST(APPEND PROJECT_SRCS ${PROJECT_HDRS}) + #Generate sources from our proto files and store them in the source tree + ADD_CUSTOM_COMMAND( + OUTPUT ${PROJECT_PROTO_SRCS} ${PROJECT_PROTO_HDRS} +-COMMAND protoc-bin -I=${CMAKE_CURRENT_SOURCE_DIR}/proto/ --cpp_out=${CMAKE_CURRENT_SOURCE_DIR}/proto/ ${PROJECT_PROTOS} +-DEPENDS protoc-bin ${PROJECT_PROTOS} ++COMMAND protoc -I=${CMAKE_CURRENT_SOURCE_DIR}/proto/ --cpp_out=${CMAKE_CURRENT_SOURCE_DIR}/proto/ ${PROJECT_PROTOS} ++DEPENDS ${PROJECT_PROTOS} + ) + + IF(WIN32) +-- +2.6.3 + diff --git a/pkgs/games/dwarf-fortress/dwarf-fortress-hacked.in b/pkgs/games/dwarf-fortress/dwarf-fortress-hacked.in deleted file mode 100644 index 027720fc378..00000000000 --- a/pkgs/games/dwarf-fortress/dwarf-fortress-hacked.in +++ /dev/null @@ -1,13 +0,0 @@ -#!@stdenv_shell@ - -data_dir=${XDG_DATA_HOME:-$HOME/.local/share}/df_linux -pkg_dir=@prefix@/share/df_linux - -. $pkg_dir/shell/install-df-data-to-home.sh -. $pkg_dir/shell/install-dfhack-data-to-home.sh -. $pkg_dir/shell/install-df-data-content-to-home.sh -. $pkg_dir/shell/export-libs.sh -. $pkg_dir/shell/export-workaround.sh - -cd "$data_dir" -exec ./dfhack "$@" diff --git a/pkgs/games/dwarf-fortress/dwarf-fortress.in b/pkgs/games/dwarf-fortress/dwarf-fortress.in deleted file mode 100644 index db06d34efd0..00000000000 --- a/pkgs/games/dwarf-fortress/dwarf-fortress.in +++ /dev/null @@ -1,14 +0,0 @@ -#!@stdenv_shell@ - -set -ex - -data_dir=${XDG_DATA_HOME:-$HOME/.local/share}/df_linux -pkg_dir=@prefix@/share/df_linux - -. $pkg_dir/shell/install-df-data-to-home.sh -. $pkg_dir/shell/install-df-data-content-to-home.sh -. $pkg_dir/shell/export-libs.sh -. $pkg_dir/shell/export-workaround.sh - -cd $data_dir -$pkg_dir/libs/Dwarf_Fortress "$@" diff --git a/pkgs/games/dwarf-fortress/dwarf-therapist/default.nix b/pkgs/games/dwarf-fortress/dwarf-therapist/default.nix new file mode 100644 index 00000000000..07714168e0e --- /dev/null +++ b/pkgs/games/dwarf-fortress/dwarf-therapist/default.nix @@ -0,0 +1,40 @@ +{ stdenv, fetchFromGitHub, coreutils, qt4, texlive }: + +let + version = "36.0.0"; +in +stdenv.mkDerivation { + name = "dwarf-therapist-original-${version}"; + + src = fetchFromGitHub { + owner = "splintermind"; + repo = "Dwarf-Therapist"; + rev = "v${version}"; + sha256 = "08xjawb25sibkkfqwd4mlq73dgmgc6lxbbd673rx7yhrsjh4z4h3"; + }; + + outputs = [ "out" "layouts" ]; + buildInputs = [ qt4 ]; + nativeBuildInputs = [ texlive ]; + + enableParallelBuilding = false; + + configurePhase = '' + qmake PREFIX=$out + ''; + + # Move layout files so they cannot be found by Therapist + postInstall = '' + mkdir -p $layouts + mv $out/share/dwarftherapist/memory_layouts/* $layouts + rmdir $out/share/dwarftherapist/memory_layouts + ''; + + meta = { + description = "Tool to manage dwarves in in a running game of Dwarf Fortress"; + maintainers = with stdenv.lib.maintainers; [ the-kenny abbradar ]; + license = stdenv.lib.licenses.mit; + platforms = stdenv.lib.platforms.linux; + homepage = https://code.google.com/r/splintermind-attributes/; + }; +} diff --git a/pkgs/games/dwarf-fortress/dwarf-therapist/wrapper.nix b/pkgs/games/dwarf-fortress/dwarf-therapist/wrapper.nix new file mode 100644 index 00000000000..a16c1284a67 --- /dev/null +++ b/pkgs/games/dwarf-fortress/dwarf-therapist/wrapper.nix @@ -0,0 +1,43 @@ +{ buildEnv, lib, dwarf-therapist-original, dwarf-fortress-original, makeWrapper }: + +let + df = dwarf-fortress-original; + dt = dwarf-therapist-original; + inifile = "linux/v0${df.baseVersion}.${df.patchVersion}.ini"; + dfHashFile = "${df}/hash.md5"; + +in buildEnv { + name = "dwarf-therapist-${lib.getVersion dt}"; + + paths = [ dt ]; + + buildInputs = [ makeWrapper ]; + + postBuild = '' + # DwarfTherapist assumes it's run in $out/share/dwarftherapist and + # therefore uses many relative paths. + rm $out/bin + mkdir $out/bin + makeWrapper ${dt}/bin/DwarfTherapist $out/bin/DwarfTherapist \ + --run "cd $out/share/dwarftherapist" + + # Fix checksum of memory access directives. We really need #4621 fixed! + recreate_dir() { + rm "$out/$1" + mkdir -p "$out/$1" + for i in "${dt}/$1/"*; do + ln -s "$i" "$out/$1" + done + } + + recreate_dir share + recreate_dir share/dwarftherapist + mkdir -p $out/share/dwarftherapist/memory_layouts/linux + origmd5=$(cat "${dfHashFile}.orig" | cut -c1-8) + patchedmd5=$(cat "${dfHashFile}" | cut -c1-8) + substitute \ + ${dt.layouts}/${inifile} \ + $out/share/dwarftherapist/memory_layouts/${inifile} \ + --replace "$origmd5" "$patchedmd5" + ''; +} diff --git a/pkgs/games/dwarf-fortress/export-libs.sh.in b/pkgs/games/dwarf-fortress/export-libs.sh.in deleted file mode 100644 index 453295ca6dd..00000000000 --- a/pkgs/games/dwarf-fortress/export-libs.sh.in +++ /dev/null @@ -1,12 +0,0 @@ -export LD_LIBRARY_PATH=\ -@stdenv_cc@/lib:\ -@SDL@/lib:\ -@SDL_image@/lib/:\ -@SDL_ttf@/lib/:\ -@gtk2@/lib/:\ -@glib@/lib/:\ -@mesa@/lib/:\ -@openal@/lib/:\ -@libsndfile@/lib:\ -@zlib@/lib:\ -$data_dir/df_linux/libs/ diff --git a/pkgs/games/dwarf-fortress/export-workaround.sh b/pkgs/games/dwarf-fortress/export-workaround.sh deleted file mode 100644 index 716d171625c..00000000000 --- a/pkgs/games/dwarf-fortress/export-workaround.sh +++ /dev/null @@ -1 +0,0 @@ -export SDL_DISABLE_LOCK_KEYS=1 # Work around for bug in Debian/Ubuntu SDL patch. diff --git a/pkgs/games/dwarf-fortress/game.nix b/pkgs/games/dwarf-fortress/game.nix new file mode 100644 index 00000000000..7e0c1b34af7 --- /dev/null +++ b/pkgs/games/dwarf-fortress/game.nix @@ -0,0 +1,48 @@ +{ stdenv, lib, fetchurl +, SDL, dwarf-fortress-unfuck +}: + +let + baseVersion = "42"; + patchVersion = "05"; + dfVersion = "0.${baseVersion}.${patchVersion}"; + libpath = lib.makeLibraryPath [ stdenv.cc.cc stdenv.glibc dwarf-fortress-unfuck SDL ]; + +in + +assert dwarf-fortress-unfuck.dfVersion == dfVersion; + +stdenv.mkDerivation { + name = "dwarf-fortress-original-${dfVersion}"; + + src = fetchurl { + url = "http://www.bay12games.com/dwarves/df_${baseVersion}_${patchVersion}_linux.tar.bz2"; + sha256 = "0g7r0v2lsqj9ryxh12q8yrk96bgs00rf2ncw228cwwqgmps3xcws"; + }; + + installPhase = '' + mkdir -p $out + cp -r * $out + rm $out/libs/lib* + + # Store the original hash + md5sum $out/libs/Dwarf_Fortress | awk '{ print $1 }' > $out/hash.md5.orig + + patchelf \ + --set-interpreter $(cat ${stdenv.cc}/nix-support/dynamic-linker) \ + --set-rpath "${libpath}" \ + $out/libs/Dwarf_Fortress + + # Store the new hash + md5sum $out/libs/Dwarf_Fortress | awk '{ print $1 }' > $out/hash.md5 + ''; + + passthru = { inherit baseVersion patchVersion dfVersion; }; + + meta = { + description = "A single-player fantasy game with a randomly generated adventure world"; + homepage = http://www.bay12games.com/dwarves; + license = lib.licenses.unfreeRedistributable; + maintainers = with lib.maintainers; [ a1russell robbinch roconnor the-kenny abbradar ]; + }; +} diff --git a/pkgs/games/dwarf-fortress/install-df-data-content-to-home.sh b/pkgs/games/dwarf-fortress/install-df-data-content-to-home.sh deleted file mode 100644 index 600af677322..00000000000 --- a/pkgs/games/dwarf-fortress/install-df-data-content-to-home.sh +++ /dev/null @@ -1,4 +0,0 @@ -for link in announcement art dipscript help index initial_movies movies shader.fs shader.vs sound speech; do - cp -r $pkg_dir/data/$link "$data_dir/data/$link" - chmod -R u+rw "$data_dir/data/$link" -done diff --git a/pkgs/games/dwarf-fortress/install-df-data-to-home.sh b/pkgs/games/dwarf-fortress/install-df-data-to-home.sh deleted file mode 100644 index 42c8c464809..00000000000 --- a/pkgs/games/dwarf-fortress/install-df-data-to-home.sh +++ /dev/null @@ -1,12 +0,0 @@ -mkdir -p $data_dir -if [[ $(readlink $data_dir/raw) != "$pkg_dir/raw" ]]; then - rm -f $data_dir/raw - ln -s $pkg_dir/raw $data_dir/raw -fi -if [[ $(readlink $data_dir/libs) != "$pkg_dir/libs" ]]; then - rm -f $data_dir/libs - ln -s $pkg_dir/libs $data_dir/libs -fi -mkdir -p "$data_dir/data" -cp -rn $pkg_dir/data/init $data_dir/data/init -chmod -R u+rw $data_dir/data/init diff --git a/pkgs/games/dwarf-fortress/install-dfhack-data-to-home.sh b/pkgs/games/dwarf-fortress/install-dfhack-data-to-home.sh deleted file mode 100644 index 9d316fde949..00000000000 --- a/pkgs/games/dwarf-fortress/install-dfhack-data-to-home.sh +++ /dev/null @@ -1,16 +0,0 @@ -if [[ $(readlink $data_dir/hack) != "$pkg_dir/hack" ]]; then - rm -f $data_dir/hack - ln -s $pkg_dir/hack $data_dir/hack -fi -if [[ $(readlink $data_dir/dfhack) != "$pkg_dir/dfhack" ]]; then - rm -f $data_dir/dfhack - ln -s $pkg_dir/dfhack $data_dir/dfhack -fi -if [[ $(readlink $data_dir/dfhack.init-example) != "$pkg_dir/dfhack.init-example" ]]; then - rm -f $data_dir/dfhack.init-example - ln -s $pkg_dir/dfhack.init-example $data_dir/dfhack.init-example -fi -if [[ $(readlink $data_dir/dfhack-run) != "$pkg_dir/dfhack-run" ]]; then - rm -f $data_dir/dfhack-run - ln -s $pkg_dir/dfhack-run $data_dir/dfhack-run -fi diff --git a/pkgs/games/dwarf-fortress/themes/phoebus.nix b/pkgs/games/dwarf-fortress/themes/phoebus.nix new file mode 100644 index 00000000000..2183a6245c0 --- /dev/null +++ b/pkgs/games/dwarf-fortress/themes/phoebus.nix @@ -0,0 +1,33 @@ +{ stdenv, fetchFromGitHub }: + +# On upgrade check https://github.com/fricy/Phoebus/blob/master/manifest.json +# for compatibility information. + +stdenv.mkDerivation { + name = "phoebus-theme-20160118"; + + src = fetchFromGitHub { + owner = "fricy"; + repo = "Phoebus"; + rev = "2c5777b0f307b1d752a8a484c6a05b67531c84a9"; + sha256 = "0a5ixm181wz7crr3rpa2mh0drb371j5hvizqninvdnhah2mypz8v"; + }; + + installPhase = '' + mkdir $out + cp -r data raw $out + ''; + + passthru.dfVersion = "0.42.05"; + + preferLocalBuild = true; + + meta = with stdenv.lib; { + description = "Phoebus graphics set for Dwarf Fortress"; + homepage = "http://www.bay12forums.com/smf/index.php?topic=137096.0"; + platforms = platforms.all; + maintainers = with maintainers; [ a1russell abbradar ]; + # https://github.com/fricy/Phoebus/issues/5 + license = licenses.free; + }; +} diff --git a/pkgs/games/dwarf-fortress/unfuck.nix b/pkgs/games/dwarf-fortress/unfuck.nix new file mode 100644 index 00000000000..92f4a954330 --- /dev/null +++ b/pkgs/games/dwarf-fortress/unfuck.nix @@ -0,0 +1,41 @@ +{ stdenv, fetchgit, cmake +, mesa, SDL, SDL_image, SDL_ttf, glew, openalSoft +, ncurses, glib, gtk2, libsndfile +}: + +stdenv.mkDerivation { + name = "dwarf_fortress_unfuck-20160118"; + + src = fetchgit { + url = "https://github.com/svenstaro/dwarf_fortress_unfuck"; + rev = "9a796c6d3cd7d41784e9d1d22a837a1ee0ff8553"; + sha256 = "0ibxdn684zpk3v2gigardq6z9mydc2s9hns8hlxjyyyhnk1ar61g"; + }; + + cmakeFlags = [ + "-DGTK2_GLIBCONFIG_INCLUDE_DIR=${glib}/lib/glib-2.0/include" + "-DGTK2_GDKCONFIG_INCLUDE_DIR=${gtk2}/lib/gtk-2.0/include" + ]; + + nativeBuildInputs = [ cmake ]; + buildInputs = [ + mesa SDL SDL_image SDL_ttf glew openalSoft + ncurses gtk2 libsndfile + ]; + + installPhase = '' + install -D -m755 ../build/libgraphics.so $out/lib/libgraphics.so + ''; + + enableParallelBuilding = true; + + passthru.dfVersion = "0.42.05"; + + meta = with stdenv.lib; { + description = "Unfucked multimedia layer for Dwarf Fortress"; + homepage = https://github.com/svenstaro/dwarf_fortress_unfuck; + license = licenses.free; + platforms = [ "i686-linux" ]; + maintainers = with maintainers; [ abbradar ]; + }; +} diff --git a/pkgs/games/dwarf-fortress/wrapper/default.nix b/pkgs/games/dwarf-fortress/wrapper/default.nix new file mode 100644 index 00000000000..5493cdb3faf --- /dev/null +++ b/pkgs/games/dwarf-fortress/wrapper/default.nix @@ -0,0 +1,68 @@ +{ stdenv, lib, buildEnv, dwarf-fortress-original, substituteAll +, enableDFHack ? false, dfhack +, themes ? {} +, theme ? null +}: + +let + ptheme = + if builtins.isString theme + then builtins.getAttr theme themes + else theme; + + # These are in inverse order for first packages to override the next ones. + pkgs = lib.optional (theme != null) ptheme + ++ lib.optional enableDFHack dfhack + ++ [ dwarf-fortress-original ]; + + env = buildEnv { + name = "dwarf-fortress-env-${dwarf-fortress-original.dfVersion}"; + paths = pkgs; + ignoreCollisions = true; + postBuild = lib.optionalString enableDFHack '' + # #4621 + if [ -L "$out/hack" ]; then + rm $out/hack + mkdir $out/hack + for i in ${dfhack}/hack/*; do + ln -s $i $out/hack + done + fi + rm $out/hack/symbols.xml + substitute ${dfhack}/hack/symbols.xml $out/hack/symbols.xml \ + --replace $(cat ${dwarf-fortress-original}/hash.md5.orig) \ + $(cat ${dwarf-fortress-original}/hash.md5) + ''; + }; +in + +assert lib.all (x: x.dfVersion == dwarf-fortress-original.dfVersion) pkgs; + +stdenv.mkDerivation rec { + name = "dwarf-fortress-${dwarf-fortress-original.dfVersion}"; + + dfInit = substituteAll { + name = "dwarf-fortress-init"; + src = ./dwarf-fortress-init.in; + inherit env; + }; + + runDF = ./dwarf-fortress.in; + runDFHack = ./dfhack.in; + + buildCommand = '' + mkdir -p $out/bin + + substitute $runDF $out/bin/dwarf-fortress \ + --subst-var-by stdenv_shell ${stdenv.shell} \ + --subst-var dfInit + chmod 755 $out/bin/dwarf-fortress + '' + lib.optionalString enableDFHack '' + substitute $runDFHack $out/bin/dfhack \ + --subst-var-by stdenv_shell ${stdenv.shell} \ + --subst-var dfInit + chmod 755 $out/bin/dfhack + ''; + + preferLocalBuild = true; +} diff --git a/pkgs/games/dwarf-fortress/wrapper/dfhack.in b/pkgs/games/dwarf-fortress/wrapper/dfhack.in new file mode 100644 index 00000000000..d53769ca4b6 --- /dev/null +++ b/pkgs/games/dwarf-fortress/wrapper/dfhack.in @@ -0,0 +1,11 @@ +#!@stdenv_shell@ -e + +source @dfInit@ + +for i in dfhack.init-example dfhack-config/default hack/*; do + update_path "$i" +done + +cd "$DF_DIR" +LD_LIBRARY_PATH="$env_dir/hack/libs:$env_dir/hack:$LD_LIBRARY_PATH" \ + LD_PRELOAD=$env_dir/hack/libdfhack.so exec $env_dir/libs/Dwarf_Fortress "$@" diff --git a/pkgs/games/dwarf-fortress/wrapper/dwarf-fortress-init.in b/pkgs/games/dwarf-fortress/wrapper/dwarf-fortress-init.in new file mode 100644 index 00000000000..1fd6178895d --- /dev/null +++ b/pkgs/games/dwarf-fortress/wrapper/dwarf-fortress-init.in @@ -0,0 +1,41 @@ +shopt -s extglob + +[ -z "$DF_DIR" ] && DF_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/df_linux" +env_dir="@env@" + +update_path() { + local path="$1" + + mkdir -p "$DF_DIR/$(dirname "$path")" + # If user has replaced these data directories, let them stay. + if [ ! -e "$DF_DIR/$path" ] || [ -L "$DF_DIR/$path" ]; then + rm -f "$DF_DIR/$path" + ln -s "$env_dir/$path" "$DF_DIR/$path" + fi +} + +forcecopy_path() { + local path="$1" + + mkdir -p "$DF_DIR/$(dirname "$path")" + rm -rf "$DF_DIR/$path" + cp -rL --no-preserve=all "$env_dir/$path" "$DF_DIR/$path" +} + +mkdir -p "$DF_DIR" + +cat <<EOF >&2 +Using $DF_DIR as Dwarf Fortress overlay directory. +If you do any changes in it, don't forget to clean it when updating the game version! +We try to detect changes based on data directories being symbolic links -- keep this in mind. + +EOF + +cd "$env_dir" +for i in data/init/* data/!(init|index|announcement) raw; do + update_path "$i" +done + +forcecopy_path data/index +# For some reason, it's needed to be writable... +forcecopy_path data/announcement diff --git a/pkgs/games/dwarf-fortress/wrapper/dwarf-fortress.in b/pkgs/games/dwarf-fortress/wrapper/dwarf-fortress.in new file mode 100644 index 00000000000..f405f1b0e39 --- /dev/null +++ b/pkgs/games/dwarf-fortress/wrapper/dwarf-fortress.in @@ -0,0 +1,6 @@ +#!@stdenv_shell@ -e + +source @dfInit@ + +cd "$DF_DIR" +exec "$env_dir/libs/Dwarf_Fortress" "$@" diff --git a/pkgs/games/dwarf-therapist/default.nix b/pkgs/games/dwarf-therapist/default.nix deleted file mode 100644 index 4e676bf5f9d..00000000000 --- a/pkgs/games/dwarf-therapist/default.nix +++ /dev/null @@ -1,48 +0,0 @@ -{ stdenv, coreutils, fetchgit, qt4, dwarf_fortress, bash, makeWrapper }: - -let - version = "31.0.0"; - df = dwarf_fortress; -in -stdenv.mkDerivation rec { - name = "dwarf-therapist-${version}"; - - src = fetchgit { - url = "https://github.com/splintermind/Dwarf-Therapist.git"; - rev = "refs/tags/v${version}"; - sha256 = "02d6k8c3vm401v04ln9q405njarx869jpfyf42lwskijrzjygk9x"; - }; - - # Needed for hashing - dfHashFile = "${df}/share/df_linux/hash.md5"; - - buildInputs = [ coreutils qt4 df makeWrapper ]; - enableParallelBuilding = false; - - configurePhase = '' - qmake PREFIX=$out - ''; - - postInstall = '' - # DwarfTherapist assumes it's run in $out/share/dwarftherapist and - # therefore uses many relative paths. - rm $out/bin/dwarftherapist - wrapProgram $out/bin/DwarfTherapist \ - --run "cd $out/share/dwarftherapist" - ''; - - postFixup = '' - # Fix checksum of memory access directives - substituteInPlace $out/share/dwarftherapist/memory_layouts/linux/v0${df.baseVersion}.${df.patchVersion}.ini \ - --replace $(cat "${dfHashFile}.orig") $(cat "${dfHashFile}.patched") - ''; - - meta = { - description = "Tool to manage dwarves in in a running game of Dwarf Fortress"; - maintainers = with stdenv.lib.maintainers; [ the-kenny ]; - license = stdenv.lib.licenses.mit; - platforms = stdenv.lib.platforms.linux; - hydraPlatforms = []; - homepage = https://code.google.com/r/splintermind-attributes/; - }; -} diff --git a/pkgs/games/eduke32/default.nix b/pkgs/games/eduke32/default.nix index 048688fe033..beb2bb57908 100644 --- a/pkgs/games/eduke32/default.nix +++ b/pkgs/games/eduke32/default.nix @@ -4,9 +4,9 @@ let date = "20150420"; rev = "5160"; - version = "${date}-${rev}"; in stdenv.mkDerivation rec { name = "eduke32-${version}"; + version = "${date}-${rev}"; src = fetchurl { url = "http://dukeworld.duke4.net/eduke32/synthesis/${version}/eduke32_src_${version}.tar.xz"; @@ -66,7 +66,6 @@ in stdenv.mkDerivation rec { ''; meta = with stdenv.lib; { - inherit version; description = "Enhanched port of Duke Nukem 3D for various platforms"; license = licenses.gpl2Plus; homepage = http://eduke32.com; diff --git a/pkgs/games/factorio/default.nix b/pkgs/games/factorio/default.nix new file mode 100644 index 00000000000..b08f977cda6 --- /dev/null +++ b/pkgs/games/factorio/default.nix @@ -0,0 +1,100 @@ +{ stdenv, callPackage, fetchurl, makeWrapper +# Begin libraries +, alsaLib, libX11, libXcursor, libXinerama, libXrandr, libXi +# Begin download parameters +, username ? "" +, password ? "" +}: + +let + version = "0.12.20"; + + fetch = callPackage ./fetch.nix { username = username; password = password; }; + arch = if stdenv.system == "x86_64-linux" then "x64" + else if stdenv.system == "i686-linux" then "x32" + else abort "Unsupported platform"; + + variants = { + x64 = { + url = "https://www.factorio.com/get-download/${version}/alpha/linux64"; + sha256 = "1xpzrx3q678519qgjl92fxn3qv55hd188x9jp6dcfk2ljhi1gmqk"; + }; + + x32 = { + url = "https://www.factorio.com/get-download/${version}/alpha/linux32"; + sha256 = "1dl1dsp4nni5nda437ckyw1ss6w168g19v51h7cdvb3cgsdb7sab"; + }; + }; +in + +stdenv.mkDerivation rec { + name = "factorio-${version}"; + + src = fetch variants.${arch}; + + libPath = stdenv.lib.makeLibraryPath [ + alsaLib + libX11 + libXcursor + libXinerama + libXrandr + libXi + ]; + + buildInputs = [ makeWrapper ]; + + installPhase = '' + mkdir -p $out/{bin,share/factorio} + cp -a bin/${arch}/factorio $out/bin/factorio.${arch} + cp -a doc-html data $out/share/factorio/ + + # Fortunately, Factorio already supports system-wide installs. + # Unfortunately it's a bit inconvenient to set the paths. + cat > $out/share/factorio/config-base.cfg <<EOF +use-system-read-write-data-directories=false +[path] +read-data=$out/share/factorio/data/ +EOF + + cat > $out/share/factorio/update-config.sh <<EOF +if [[ -e ~/.factorio/config.cfg ]]; then + # Config file exists, but may have wrong path. + # Try to edit it. I'm sure this is perfectly safe and will never go wrong. + sed -i 's|^read-data=.*|read-data=$out/share/factorio/data/|' ~/.factorio/config.cfg +else + # Config file does not exist. Phew. + install -D $out/share/factorio/config-base.cfg ~/.factorio/config.cfg +fi +EOF + chmod a+x $out/share/factorio/update-config.sh + + patchelf \ + --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \ + $out/bin/factorio.${arch} + + makeWrapper $out/bin/factorio.${arch} $out/bin/factorio \ + --prefix LD_LIBRARY_PATH : /run/opengl-driver/lib:$libPath \ + --run "$out/share/factorio/update-config.sh" \ + --add-flags "-c \$HOME/.factorio/config.cfg" + ''; + + meta = { + description = "A game in which you build and maintain factories."; + longDescription = '' + Factorio is a game in which you build and maintain factories. + + You will be mining resources, researching technologies, building + infrastructure, automating production and fighting enemies. Use your + imagination to design your factory, combine simple elements into + ingenious structures, apply management skills to keep it working and + finally protect it from the creatures who don't really like you. + + Factorio has been in development since spring of 2012 and it is + currently in late alpha. + ''; + homepage = https://www.factorio.com/; + license = stdenv.lib.licenses.unfree; + maintainers = [ stdenv.lib.maintainers.Baughn ]; + platforms = [ "i686-linux" "x86_64-linux" ]; + }; +} diff --git a/pkgs/games/factorio/fetch.nix b/pkgs/games/factorio/fetch.nix new file mode 100644 index 00000000000..03dc786492a --- /dev/null +++ b/pkgs/games/factorio/fetch.nix @@ -0,0 +1,33 @@ +{ stdenv, curl +# Begin download parameters +, username ? "" +, password ? "" +}: + +{ + # URL to fetch. + url ? "" + + # Login URL. +, loginUrl ? "https://www.factorio.com/login" + + # SHA256 of the fetched URL. +, sha256 ? "" +}: + +stdenv.mkDerivation { + name = "factorio.tar.gz"; + + buildInputs = [ curl ]; + + inherit url loginUrl username password; + + builder = ./fetch.sh; + + outputHashAlgo = "sha256"; + outputHash = sha256; + outputHashMode = "flat"; + + # There's no point in downloading remotely, we'd just slow things down. + preferLocalBuild = true; +} diff --git a/pkgs/games/factorio/fetch.sh b/pkgs/games/factorio/fetch.sh new file mode 100644 index 00000000000..ad976673686 --- /dev/null +++ b/pkgs/games/factorio/fetch.sh @@ -0,0 +1,44 @@ +source $stdenv/setup + +# Curl flags to increase reliability a bit. +# +# Can't use fetchurl, for several reasons. One is that we definitely +# don't want --insecure for the login, though we need it for the +# download as their download cert isn't in the standard linux bundle. +curl="curl \ + --max-redirs 20 \ + --retry 3 \ + --cacert /etc/ssl/certs/ca-bundle.crt \ + $curlOpts \ + $NIX_CURL_FLAGS" + +# We don't want the password to be on any program's argv, as it may be +# visible in /proc. Writing it to file with echo should be safe, since +# it's a shell builtin. +echo "password=$password" > password +# Might as well hide the username as well. +echo "username-or-email=$username" > username + +# Log in. We don't especially care about the result, but let's check if login failed. +$curl -c cookies -d @username -d @password $loginUrl -D headers > /dev/null + +if grep -q 'Location: /' headers; then + # Now download. We need --insecure for this, but the sha256 should cover us. + $curl -b cookies --insecure --location $url > $out +else + echo 'Login failed' + echo 'Please set username and password with config.nix,' + echo 'or /etc/nix/nixpkgs-config.nix if on NixOS.' + echo + echo 'Example:' + echo '{' + echo ' packageOverrides = pkgs: rec {' + echo ' factorio = pkgs.factorio.override {' + echo ' username = "<username or email address>";' + echo ' password = "<password>";' + echo ' };' + echo ' };' + echo '}' + + exit 1 +fi diff --git a/pkgs/games/hedgewars/fix-ghc-7.8-build-failure.diff b/pkgs/games/hedgewars/fix-ghc-7.8-build-failure.diff deleted file mode 100644 index 7974c6797fc..00000000000 --- a/pkgs/games/hedgewars/fix-ghc-7.8-build-failure.diff +++ /dev/null @@ -1,16 +0,0 @@ -## fix-ghc-7.8-build-failure.diff [diff] -diff --git a/gameServer/Actions.hs b/gameServer/Actions.hs -index 2cebe4f..355ee26 100644 ---- a/gameServer/Actions.hs -+++ b/gameServer/Actions.hs -@@ -562,7 +562,7 @@ processAction (AddClient cl) = do - si <- gets serverInfo - newClId <- io $ do - ci <- addClient rnc cl -- _ <- Exception.mask (forkIO . clientRecvLoop (clientSocket cl) (coreChan si) (sendChan cl) ci) -+ _ <- Exception.mask (\x -> forkIO $ clientRecvLoop (clientSocket cl) (coreChan si) (sendChan cl) ci x) - - infoM "Clients" (show ci ++ ": New client. Time: " ++ show (connectTime cl)) - - - diff --git a/pkgs/games/pioneer/default.nix b/pkgs/games/pioneer/default.nix new file mode 100644 index 00000000000..fc5bfbb4b70 --- /dev/null +++ b/pkgs/games/pioneer/default.nix @@ -0,0 +1,42 @@ +{ fetchFromGitHub, stdenv, automake, curl, libsigcxx, SDL2 +, SDL2_image, freetype, libvorbis, libpng, assimp, mesa +, autoconf, pkgconfig }: + +let + version = "20160116"; + checksum = "07w5yin2xhb0fdlj1aipi64yx6vnr1siahsy0bxvzi06d73ffj6r"; +in +stdenv.mkDerivation rec { + name = "pioneer-${version}"; + + src = fetchFromGitHub{ + owner = "pioneerspacesim"; + repo = "pioneer"; + rev = version; + sha256 = checksum; + }; + + buildInputs = [ + automake curl libsigcxx SDL2 SDL2_image freetype libvorbis + libpng assimp mesa autoconf pkgconfig + ]; + + NIX_CFLAGS_COMPILE = [ + "-I${SDL2}/include/SDL2" + ]; + + + preConfigure = '' + export PIONEER_DATA_DIR="$out/share/pioneer/data"; + ./bootstrap + ''; + + meta = with stdenv.lib; { + description = "Pioneer is a space adventure game set in the Milky Way galaxy at the turn of the 31st century."; + homepage = "http://pioneerspacesim.net"; + license = with licenses; [ + gpl3 cc-by-sa-30 + ]; + platforms = [ "x86_64-linux" "i686-linux" ]; + }; +} diff --git a/pkgs/games/sdlmame/default.nix b/pkgs/games/sdlmame/default.nix index 52a89270574..5e52a92e621 100644 --- a/pkgs/games/sdlmame/default.nix +++ b/pkgs/games/sdlmame/default.nix @@ -40,5 +40,6 @@ stdenv.mkDerivation rec { license = "MAME"; maintainers = with maintainers; [ lovek323 ]; platforms = platforms.linux; + broken = true; # URL doesn't work anymore }; } diff --git a/pkgs/games/soi/default.nix b/pkgs/games/soi/default.nix index 2e8a085ef47..7c4b2fe823c 100644 --- a/pkgs/games/soi/default.nix +++ b/pkgs/games/soi/default.nix @@ -1,9 +1,9 @@ { stdenv, fetchurl, cmake , boost, eigen2, lua, luabind, mesa, SDL }: -let version = "0.1.2"; in stdenv.mkDerivation rec { name = "soi-${version}"; + version = "0.1.2"; src = fetchurl { url = "mirror://sourceforge/project/soi/Spheres%20of%20Influence-${version}-Source.tar.bz2"; diff --git a/pkgs/games/steam/chrootenv.nix b/pkgs/games/steam/chrootenv.nix index fc0e70e4354..e6652d2f023 100644 --- a/pkgs/games/steam/chrootenv.nix +++ b/pkgs/games/steam/chrootenv.nix @@ -1,6 +1,9 @@ { lib, buildFHSUserEnv, steam -, withJava ? false +, withJava ? false , withPrimus ? false +, nativeOnly ? false +, runtimeOnly ? false +, newStdcpp ? false }: buildFHSUserEnv { @@ -20,7 +23,7 @@ buildFHSUserEnv { # Needed by gdialog, including in the steam-runtime perl ] - ++ lib.optional withJava jdk + ++ lib.optional withJava jdk ++ lib.optional withPrimus primus ; @@ -38,7 +41,9 @@ buildFHSUserEnv { gst_all_1.gst-plugins-ugly libdrm - steamPackages.steam-runtime-wrapped + (steamPackages.steam-runtime-wrapped.override { + inherit nativeOnly runtimeOnly newStdcpp; + }) ]; extraBuildCommands = '' diff --git a/pkgs/games/steam/default.nix b/pkgs/games/steam/default.nix index dd02903dcb2..64f8cfe2c28 100644 --- a/pkgs/games/steam/default.nix +++ b/pkgs/games/steam/default.nix @@ -1,17 +1,11 @@ -{ pkgs, newScope -, nativeOnly ? false -, runtimeOnly ? false -, newStdcpp ? false -}: +{ pkgs, newScope }: let callPackage = newScope self; self = rec { steam-runtime = callPackage ./runtime.nix { }; - steam-runtime-wrapped = callPackage ./runtime-wrapped.nix { - inherit nativeOnly runtimeOnly newStdcpp; - }; + steam-runtime-wrapped = callPackage ./runtime-wrapped.nix { }; steam = callPackage ./steam.nix { }; steam-chrootenv = callPackage ./chrootenv.nix { }; steam-fonts = callPackage ./fonts.nix { }; |