From 615f8a3f6f064a5b34463d933c12a4087a6f4791 Mon Sep 17 00:00:00 2001 From: Guillaume Maudoux Date: Fri, 20 Apr 2018 18:19:49 +0200 Subject: [PATCH 1/4] spacechem: init --- pkgs/games/humblebundle/default.nix | 1 + pkgs/games/humblebundle/spacechem.nix | 69 +++++++++++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 pkgs/games/humblebundle/spacechem.nix diff --git a/pkgs/games/humblebundle/default.nix b/pkgs/games/humblebundle/default.nix index 5de3f40e..9ced36f7 100644 --- a/pkgs/games/humblebundle/default.nix +++ b/pkgs/games/humblebundle/default.nix @@ -30,6 +30,7 @@ let owlboy = callPackage ./owlboy.nix {}; pico-8 = callPackage ./pico-8.nix {}; rocketbirds = callPackage ./rocketbirds.nix {}; + spacechem = callPackage ./spacechem.nix {}; spaz = callPackage ./spaz.nix {}; starbound = callPackage ./starbound.nix {}; swordsandsoldiers = callPackage ./swordsandsoldiers.nix {}; diff --git a/pkgs/games/humblebundle/spacechem.nix b/pkgs/games/humblebundle/spacechem.nix new file mode 100644 index 00000000..41a73c54 --- /dev/null +++ b/pkgs/games/humblebundle/spacechem.nix @@ -0,0 +1,69 @@ +{ stdenv, lib, fetchHumbleBundle, buildGame +, SDL, SDL_mixer, SDL_image, SDL_net, SDL_gfx, SDL_ttf, smpeg +, mono4, sqlite, coreutils, makeWrapper}: + +with lib; + +buildGame rec { + version = "1013_FIXED"; + name = "spacechem-${version}"; + + src = fetchHumbleBundle { + name = "SpaceChem_Linux_v1013_FIXED.zip"; + machineName = "spacechem_android_pc_soundtrack_linux"; + downloadName = "download"; + md5 = "c290e8631ae3380b7e70362501a5adb6"; + }; + + buildInputs = [ makeWrapper ]; + + postPatch = let + dllmap = { + SDL = "${SDL}/lib/libSDL.so"; + SDL_image = "${SDL_image}/lib/libSDL_image.so"; + SDL_mixer = "${SDL_mixer}/lib/libSDL_mixer.so"; + SDL_ttf = "${SDL_ttf}/lib/libSDL_ttf.so"; + SDL_net = "${SDL_net}/lib/libSDL_net.so"; + smpeg = "${smpeg}/lib/libsmpeg.so"; + SDL_gfx = "${SDL_gfx}/lib/libSDL_gfx.so"; + }; + in '' + ${concatStrings (mapAttrsToList (dll: target: '' + sed -i -e '//,/<\/dllmap>/ { + /dllentry os="linux"/s!dll="[^"]*"!dll="'"${target}"'"! + }' SpaceChem/Tao.Sdl.dll.config + '') dllmap)} + + rm SpaceChem/Mono.Security.dll + rm SpaceChem/spacechem-launcher.sh + + cat > SpaceChem/System.Data.SQLite.dll.config < + + + EOF + cat > SpaceChem/SpaceChem.exe.config < + + + + EOF + ''; + + installPhase = '' + runHook preInstall + + mkdir -p $out/lib + cp -rvt $out/lib SpaceChem + + runHook postInstall + ''; + + # coreutils because Tao.OpenGL relies on uname for platform detection + postInstall = '' + makeWrapper ${mono4}/bin/mono $out/bin/spacechem \ + --prefix PATH : ${coreutils}/bin \ + --run "cd $out/lib/SpaceChem" \ + --add-flags $out/lib/SpaceChem/SpaceChem.exe + ''; +} From f88dede76f5a1d12308831fbd060e593684bd1ae Mon Sep 17 00:00:00 2001 From: Guillaume Maudoux Date: Mon, 30 Sep 2019 01:04:26 +0200 Subject: [PATCH 2/4] spacechem: add a proper sandbox path --- pkgs/games/humblebundle/spacechem.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkgs/games/humblebundle/spacechem.nix b/pkgs/games/humblebundle/spacechem.nix index 41a73c54..e4fc2226 100644 --- a/pkgs/games/humblebundle/spacechem.nix +++ b/pkgs/games/humblebundle/spacechem.nix @@ -7,7 +7,6 @@ with lib; buildGame rec { version = "1013_FIXED"; name = "spacechem-${version}"; - src = fetchHumbleBundle { name = "SpaceChem_Linux_v1013_FIXED.zip"; machineName = "spacechem_android_pc_soundtrack_linux"; @@ -15,6 +14,11 @@ buildGame rec { md5 = "c290e8631ae3380b7e70362501a5adb6"; }; + sandbox.paths.required = [ + "$XDG_DATA_HOME/Zachtronics Industries/SpaceChem" + "$XDG_CONFIG_HOME/pulse" + ]; + buildInputs = [ makeWrapper ]; postPatch = let From 7bb7982491e995c3cf81360c1a905507a8d1b07b Mon Sep 17 00:00:00 2001 From: Guillaume Maudoux Date: Mon, 30 Sep 2019 10:52:30 +0200 Subject: [PATCH 3/4] Update pkgs/games/humblebundle/default.nix Co-Authored-By: aszlig --- pkgs/games/humblebundle/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/games/humblebundle/default.nix b/pkgs/games/humblebundle/default.nix index 9ced36f7..d32144c7 100644 --- a/pkgs/games/humblebundle/default.nix +++ b/pkgs/games/humblebundle/default.nix @@ -30,7 +30,7 @@ let owlboy = callPackage ./owlboy.nix {}; pico-8 = callPackage ./pico-8.nix {}; rocketbirds = callPackage ./rocketbirds.nix {}; - spacechem = callPackage ./spacechem.nix {}; + spacechem = callPackage_i686 ./spacechem.nix {}; spaz = callPackage ./spaz.nix {}; starbound = callPackage ./starbound.nix {}; swordsandsoldiers = callPackage ./swordsandsoldiers.nix {}; From dcea987124f3c11c5283e79c755f02291660d70e Mon Sep 17 00:00:00 2001 From: Guillaume Maudoux Date: Mon, 30 Sep 2019 12:04:57 +0200 Subject: [PATCH 4/4] SpaceChem: soem fixups --- pkgs/games/humblebundle/spacechem.nix | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/pkgs/games/humblebundle/spacechem.nix b/pkgs/games/humblebundle/spacechem.nix index e4fc2226..6181e1c0 100644 --- a/pkgs/games/humblebundle/spacechem.nix +++ b/pkgs/games/humblebundle/spacechem.nix @@ -1,6 +1,8 @@ -{ stdenv, lib, fetchHumbleBundle, buildGame -, SDL, SDL_mixer, SDL_image, SDL_net, SDL_gfx, SDL_ttf, smpeg -, mono4, sqlite, coreutils, makeWrapper}: +{ buildGame, fetchHumbleBundle, lib + +, SDL, SDL_gfx, SDL_image, SDL_mixer, SDL_net, SDL_ttf +, coreutils, makeWrapper, mono4, smpeg, sqlite, xclip +}: with lib; @@ -10,16 +12,15 @@ buildGame rec { src = fetchHumbleBundle { name = "SpaceChem_Linux_v1013_FIXED.zip"; machineName = "spacechem_android_pc_soundtrack_linux"; - downloadName = "download"; + downloadName = "Download"; md5 = "c290e8631ae3380b7e70362501a5adb6"; }; sandbox.paths.required = [ "$XDG_DATA_HOME/Zachtronics Industries/SpaceChem" - "$XDG_CONFIG_HOME/pulse" ]; - buildInputs = [ makeWrapper ]; + nativeBuildInputs = [ makeWrapper ]; postPatch = let dllmap = { @@ -64,10 +65,12 @@ buildGame rec { ''; # coreutils because Tao.OpenGL relies on uname for platform detection + # xclip because SpaceChem relies on it for import/export of challenges postInstall = '' makeWrapper ${mono4}/bin/mono $out/bin/spacechem \ - --prefix PATH : ${coreutils}/bin \ - --run "cd $out/lib/SpaceChem" \ + --prefix PATH : ${coreutils}/bin \ + --prefix PATH : ${xclip}/bin \ + --run "cd $out/lib/SpaceChem" \ --add-flags $out/lib/SpaceChem/SpaceChem.exe ''; }