Last active
May 1, 2026 13:27
-
-
Save YellowOnion/4b4add1ac57eef78e1f9b2bf8839584d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #/usr/bin/env bash | |
| FILE="$1" | |
| BFILE=$(basename "$FILE") | |
| INFO=$( nix store prefetch-file --hash-type sha256 file://$(realpath "$FILE") --json ) | |
| echo -n "$INFO" | jq '{ "name": $name, "url" : $name, "hash" : .hash }' --arg name "$BFILE" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "name": "rimworld_anomaly_1_6_4633_rev1245_86287.sh", | |
| "url": "rimworld_anomaly_1_6_4633_rev1245_86287.sh", | |
| "hash": "sha256-PoGlcLTy7K+NiU/TfXWrDlVYJNTfKR6k+6ty8EpE61g=" | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "name": "rimworld_biotech_1_6_4633_rev1245_86287.sh", | |
| "url": "rimworld_biotech_1_6_4633_rev1245_86287.sh", | |
| "hash": "sha256-8cwVfrMSW438e0fPzWF3CmRWJuyn8ejPSDHIlcg2H/g=" | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "name": "rimworld_1_6_4633_rev1245_86287.sh", | |
| "url": "rimworld_1_6_4633_rev1245_86287.sh", | |
| "hash": "sha256-fMVuWABqrrsIj7Ap/7c+W6gtMJAgdN4oBmgWoeu5p4w=" | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "name": "rimworld_ideology_1_6_4633_rev1245_86287.sh", | |
| "url": "rimworld_ideology_1_6_4633_rev1245_86287.sh", | |
| "hash": "sha256-vIo6F2ss8Oy6NjThpFcRo3KibYU38SNvZyDpabMWYxQ=" | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "name": "rimworld_odyssey_1_6_4633_rev1245_86287.sh", | |
| "url": "rimworld_odyssey_1_6_4633_rev1245_86287.sh", | |
| "hash": "sha256-LBUCG5NkUgh8QsIFjjC1V3JaGLpe86iNgfMj6zORU6w=" | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| config, | |
| lib, | |
| pkgs, | |
| ... | |
| }: | |
| let | |
| version = "1.6.4633"; | |
| neededLibraries = with pkgs; [ | |
| libz | |
| wayland | |
| libGL | |
| libGLX | |
| udev | |
| dbus | |
| libxkbcommon | |
| libx11 | |
| libXcomposite | |
| libXcursor | |
| libXdamage | |
| libXext | |
| libXfixes | |
| libXi | |
| libXinerama | |
| libXrandr | |
| libXScrnSaver | |
| libxcb | |
| libXau | |
| libXxf86vm | |
| libpulseaudio | |
| vulkan-loader | |
| ]; | |
| gogextract = pkgs.stdenvNoCC.mkDerivation { | |
| pname = "gogextract"; | |
| version = "6601b32"; | |
| src = pkgs.fetchFromGitHub { | |
| owner = "Yepoleb"; | |
| repo = "gogextract"; | |
| rev = "6601b32feacecd18bc12f0a4c23a063c3545a095"; | |
| hash = "sha256-BTtm3Tn2hFS512w+IcJQfGKSgi2dpYLg1VxNXRODBEI="; | |
| }; | |
| buildInputs = [ pkgs.python3 ]; | |
| dontBuild = true; | |
| installPhase = '' | |
| mkdir -p $out/bin | |
| mkdir -p $out/share | |
| install $src/gogextract.py $out/bin/gogextract | |
| cp $src/LICENSE $out/share/ | |
| ''; | |
| }; | |
| rimworld-data = | |
| pname: reqArgs: | |
| (pkgs.stdenvNoCC.mkDerivation { | |
| inherit version; | |
| pname = "RimWorld_${pname}"; | |
| src = pkgs.requireFile reqArgs; | |
| nativeBuildInputs = [ | |
| gogextract | |
| pkgs.unzip | |
| ]; | |
| unpackPhase = '' | |
| gogextract $src ./ | |
| unzip -q ./data.zip | |
| ''; | |
| installPhase = '' | |
| mkdir -p $out | |
| cp -r data/noarch/game/* $out | |
| ''; | |
| dontBuild = true; | |
| dontFixup = true; | |
| }); | |
| rimworld-core = rimworld-data "core" (lib.importJSON ./core.json); | |
| rimworld-anomaly = rimworld-data "anomaly" (lib.importJSON ./anomaly.json); | |
| rimworld-biotech = rimworld-data "biotech" (lib.importJSON ./biotech.json); | |
| rimworld-ideology = rimworld-data "ideology" (lib.importJSON ./ideology.json); | |
| rimworld-odyssey = rimworld-data "odyssey" (lib.importJSON ./odyssey.json); | |
| rimworld-royalty = rimworld-data "royalty" (lib.importJSON ./royalty.json); | |
| in | |
| pkgs.stdenv.mkDerivation { | |
| pname = "RimWorld"; | |
| inherit version; | |
| nativeBuildInputs = [ | |
| pkgs.autoPatchelfHook | |
| ]; | |
| src = rimworld-core; | |
| buildInputs = neededLibraries; | |
| run = '' | |
| #!${pkgs.runtimeShell} | |
| STOREPATH=$(dirname "$(realpath $0)") | |
| STATEDIR="$HOME/.local/state/rimworld" | |
| mkdir -p "$STATEDIR" | |
| TMPDIR=$(${pkgs.mktemp}/bin/mktemp --directory) | |
| ${pkgs.bubblewrap}/bin/bwrap \ | |
| --bind / / \ | |
| --overlay-src "$STOREPATH" \ | |
| --overlay "$STATEDIR" "$TMPDIR" "$STATEDIR" \ | |
| --chdir "$STATEDIR" \ | |
| "$STATEDIR/RimWorldLinux" "$@" | |
| ''; | |
| installPhase = '' | |
| mkdir -p $out/Data | |
| ln -s ${rimworld-core}/{RimWorldLinux_Data,Version.txt,Licenses.txt,ScenarioPreview.jpg} $out/ | |
| cp -p ${rimworld-core}/{RimWorldLinux,UnityPlayer.so} $out/ | |
| chmod u+w $out/{RimWorldLinux,UnityPlayer.so} | |
| ln -s ${rimworld-core}/Data/Core $out/Data/Core | |
| ln -s ${rimworld-anomaly}/Data/Anomaly $out/Data/Anomaly | |
| ln -s ${rimworld-biotech}/Data/Biotech $out/Data/Biotech | |
| ln -s ${rimworld-ideology}/Data/Ideology $out/Data/Ideology | |
| ln -s ${rimworld-odyssey}/Data/Odyssey $out/Data/Odyssey | |
| ln -s ${rimworld-royalty}/Data/Royalty $out/Data/Royalty | |
| patchelf \ | |
| --add-needed libz.so.1 \ | |
| --add-needed libX11.so.6 \ | |
| --add-needed libXau.so.6 \ | |
| --add-needed libXcursor.so.1 \ | |
| --add-needed libXdmcp.so.6 \ | |
| --add-needed libXext.so.6 \ | |
| --add-needed libXi.so.6 \ | |
| --add-needed libXinerama.so.1 \ | |
| --add-needed libXrandr.so.2 \ | |
| --add-needed libXss.so.1 \ | |
| --add-needed libXxf86vm.so.1 \ | |
| --add-needed libxcb.so.1 \ | |
| --add-needed libdbus-1.so.3 \ | |
| --add-needed libudev.so.1 \ | |
| --add-needed libxkbcommon.so.0 \ | |
| --add-needed libGL.so.1 \ | |
| --add-needed libpulse-simple.so.0 \ | |
| $out/UnityPlayer.so | |
| echo -n "$run" > $out/rimworld | |
| chmod +x $out/rimworld | |
| ''; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "name": "rimworld_royalty_1_6_4633_rev1245_86287.sh", | |
| "url": "rimworld_royalty_1_6_4633_rev1245_86287.sh", | |
| "hash": "sha256-as64WUZItYXzSSTQj2adHu5NqMbeDpqW7cBbW9YhTRM=" | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment