nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at devShellTools-shell 181 lines 3.7 kB view raw
1{ 2 lib, 3 stdenv, 4 python3Packages, 5 fetchFromGitHub, 6 fetchzip, 7 makeBinaryWrapper, 8 9 makeDesktopItem, 10 replaceVars, 11 12 todds, 13 14 steam, 15}: 16let 17 pname = "rimsort"; 18 version = "1.0.30"; 19 20 src = fetchFromGitHub { 21 owner = "RimSort"; 22 repo = "RimSort"; 23 rev = "v${version}"; 24 hash = "sha256-f1wYoBC0EbkvYNJHkVuoMukJZMY7eNjCIzJra7/hpLs="; 25 fetchSubmodules = true; 26 }; 27 steamworksSrc = fetchzip { 28 url = "https://web.archive.org/web/20250527013243/https://partner.steamgames.com/downloads/steamworks_sdk_162.zip"; # Steam sometimes requires auth to download. 29 hash = "sha256-yDA92nGj3AKTNI4vnoLaa+7mDqupQv0E4YKRRUWqyZw="; 30 }; 31 32 steamfiles = python3Packages.buildPythonPackage { 33 pname = "steamfiles"; 34 inherit version; 35 format = "setuptools"; 36 37 src = "${src}/submodules/steamfiles"; 38 dependencies = with python3Packages; [ 39 protobuf 40 protobuf3-to-dict 41 ]; 42 }; 43 44 steam-run = 45 (steam.override { 46 privateTmp = false; 47 }).run; 48in 49 50stdenv.mkDerivation { 51 inherit pname; 52 inherit version; 53 54 unpackPhase = '' 55 runHook preUnpack 56 57 cp -r ${src} source 58 chmod -R 755 source 59 cp ${steamworksSrc}/redistributable_bin/linux64/libsteam_api.so source/ 60 61 runHook postUnpack 62 ''; 63 64 sourceRoot = "source"; 65 66 patches = [ 67 (replaceVars ./todds-path.patch { inherit todds; }) 68 (replaceVars ./steam-run.patch { inherit steam-run; }) 69 ]; 70 71 nativeBuildInputs = [ 72 makeBinaryWrapper 73 ]; 74 75 buildInputs = [ 76 todds 77 steamfiles 78 ] 79 ++ builtins.attrValues { 80 inherit (python3Packages) 81 beautifulsoup4 82 certifi 83 chardet 84 imageio 85 loguru 86 lxml 87 msgspec 88 natsort 89 networkx 90 packaging 91 platformdirs 92 psutil 93 pygit2 94 pygithub 95 pyperclip 96 pyside6 97 requests 98 sqlalchemy 99 steam 100 toposort 101 watchdog 102 xmltodict 103 steamworkspy 104 ; 105 }; 106 107 dontBuild = true; 108 109 nativeCheckInputs = with python3Packages; [ 110 pytestCheckHook 111 pytest-cov-stub 112 pytest-qt 113 pytest-xvfb 114 ]; 115 116 doCheck = true; 117 118 preCheck = '' 119 export QT_DEBUG_PLUGINS=1 120 export QT_QPA_PLATFORM=offscreen 121 export HOME=$(mktemp -d) # Some tests require a writable directory 122 ''; 123 124 disabledTestPaths = [ 125 # requires network 126 "tests/models/metadata/test_metadata_factory.py" 127 ]; 128 129 pytestFlags = [ "--doctest-modules" ]; 130 131 desktopItems = [ 132 (makeDesktopItem { 133 name = "RimSort"; 134 desktopName = "RimSort"; 135 exec = "rimsort"; 136 icon = "io.github.rimsort.rimsort"; 137 comment = "RimWorld Mod Manager"; 138 categories = [ "Game" ]; 139 }) 140 ]; 141 142 installPhase = '' 143 runHook preInstall 144 145 mkdir -p $out/lib/rimsort 146 cp -r ./* $out/lib/rimsort/ 147 148 mkdir -p $out/bin 149 150 makeBinaryWrapper \ 151 ${python3Packages.python.interpreter} \ 152 $out/bin/rimsort \ 153 --add-flags "-m app" \ 154 --chdir $out/lib/rimsort \ 155 --prefix PYTHONPATH : "$PYTHONPATH" \ 156 --set RIMSORT_DISABLE_UPDATER 1 157 158 install -D ./themes/default-icons/AppIcon_a.png $out/share/icons/hicolor/512x512/apps/io.github.rimsort.rimsort 159 160 runHook postInstall 161 ''; 162 163 meta = { 164 description = "Open source mod manager for the video game RimWorld"; 165 homepage = "https://github.com/RimSort/RimSort"; 166 license = with lib.licenses; [ 167 gpl3Only 168 # For libsteam_api.so 169 ( 170 unfreeRedistributable 171 // { 172 url = "https://partner.steamgames.com/documentation/sdk_access_agreement"; 173 } 174 ) 175 ]; 176 maintainers = with lib.maintainers; [ weirdrock ]; 177 mainProgram = "rimsort"; 178 # steamworksSrc is x86_64-linux only 179 platforms = [ "x86_64-linux" ]; 180 }; 181}