nzportable: init at 2.0.0-indev+20241012190425 (#312424)

authored by OTABI Tomoya and committed by GitHub 3d7216f0 1d4a687f

+470
+44
pkgs/by-name/nz/nzportable/assets.nix
··· 1 + { 2 + lib, 3 + stdenvNoCC, 4 + fetchFromGitHub, 5 + }: 6 + stdenvNoCC.mkDerivation { 7 + pname = "nzp-assets"; 8 + version = "0-unstable-2024-09-28-13-34-48"; 9 + 10 + src = fetchFromGitHub { 11 + owner = "nzp-team"; 12 + repo = "assets"; 13 + rev = "4a7b1b787061c1c7c17ab3b59a8e0e0f44c9546f"; 14 + hash = "sha256-gCTC/76r0ITIDLIph9uivq0ZJGaPUmlBGizdCUxJrng="; 15 + }; 16 + 17 + outputs = [ 18 + "out" 19 + "pc" 20 + ]; 21 + 22 + # TODO: add more outputs for other ports 23 + installPhase = '' 24 + runHook preInstall 25 + 26 + mkdir -p $out 27 + cp -r common/* $out 28 + 29 + mkdir -p $pc 30 + cp -r pc/* $pc 31 + chmod -R +w $pc/nzp 32 + cp -r $out/* $pc/nzp 33 + 34 + runHook postInstall 35 + ''; 36 + 37 + meta = { 38 + description = "Game asset repository for Nazi Zombies: Portable"; 39 + homepage = "https://github.com/nzp-team/assets"; 40 + license = with lib.licenses; [ cc-by-sa-40 ]; 41 + platforms = lib.platforms.all; 42 + maintainers = with lib.maintainers; [ pluiedev ]; 43 + }; 44 + }
+176
pkgs/by-name/nz/nzportable/fteqw.nix
··· 1 + { 2 + lib, 3 + stdenv, 4 + fetchFromGitHub, 5 + 6 + cmake, 7 + ninja, 8 + pkg-config, 9 + makeWrapper, 10 + zip, 11 + gettext, 12 + 13 + libpng, 14 + zlib, 15 + gnutls, 16 + libGL, 17 + xorg, 18 + alsa-lib, 19 + libjpeg, 20 + libogg, 21 + libvorbis, 22 + libopus, 23 + dbus, 24 + fontconfig, 25 + SDL2, 26 + bullet, 27 + openexr, 28 + sqlite, 29 + addDriverRunpath, 30 + 31 + enableEGL ? true, 32 + libglvnd, 33 + 34 + enableVulkan ? true, 35 + vulkan-headers, 36 + vulkan-loader, 37 + 38 + enableWayland ? true, 39 + wayland, 40 + libxkbcommon, 41 + }: 42 + stdenv.mkDerivation (finalAttrs: { 43 + pname = "nzp-fteqw"; 44 + version = "0-unstable-2024-09-11-20-07-31"; 45 + 46 + src = fetchFromGitHub { 47 + owner = "nzp-team"; 48 + repo = "fteqw"; 49 + rev = "593345a7f03245fc45580ac252857e5db5105033"; 50 + hash = "sha256-ANDHh4PKh8fAvbBiiW47l1XeGOCes0Sg595+65NFG6w="; 51 + }; 52 + 53 + nativeBuildInputs = [ 54 + cmake 55 + ninja 56 + makeWrapper 57 + pkg-config 58 + zip 59 + gettext 60 + ]; 61 + 62 + buildInputs = 63 + [ 64 + libGL 65 + xorg.libX11 66 + xorg.libXrandr 67 + xorg.libXcursor 68 + xorg.libXScrnSaver 69 + dbus 70 + fontconfig 71 + libjpeg 72 + libpng 73 + alsa-lib 74 + libogg 75 + libvorbis 76 + libopus 77 + SDL2 78 + gnutls 79 + zlib 80 + bullet 81 + ] 82 + ++ lib.optional enableEGL libglvnd 83 + ++ lib.optionals enableWayland [ 84 + wayland 85 + libxkbcommon 86 + ] 87 + ++ lib.optional enableVulkan vulkan-headers; 88 + 89 + cmakeFlags = [ 90 + (lib.cmakeFeature "FTE_BUILD_CONFIG" "${finalAttrs.src}/engine/common/config_nzportable.h") 91 + # Disable optional tools - only keep FTEQCC 92 + (lib.cmakeBool "FTE_TOOL_IQM" false) 93 + (lib.cmakeBool "FTE_TOOL_IMAGE" false) 94 + (lib.cmakeBool "FTE_TOOL_QTV" false) 95 + (lib.cmakeBool "FTE_TOOL_MASTER" false) 96 + ]; 97 + 98 + postInstall = '' 99 + mv $out/games $out/bin 100 + ''; 101 + 102 + postFixup = 103 + let 104 + # grep for `Sys_LoadLibrary` for more. 105 + # Some of the deps listed in the source code are actually not active 106 + # due to being either disabled by the nzportable profile (e.g. lua, bz2), 107 + # available in /run/opengl-driver, 108 + # or statically linked (e.g. libpng, libjpeg, zlib, freetype) 109 + # Some of them are also just deprecated by better backend options 110 + # (SDL audio is preferred over ALSA, OpenAL and PulseAudio, for example) 111 + 112 + libs = [ 113 + addDriverRunpath.driverLink 114 + 115 + # gl/gl_vidlinuxglx.c 116 + xorg.libX11 117 + xorg.libXrandr 118 + xorg.libXxf86vm 119 + xorg.libXxf86dga 120 + xorg.libXi 121 + xorg.libXcursor 122 + libGL 123 + 124 + libvorbis 125 + 126 + sqlite # server/sv_sql.c 127 + 128 + SDL2 # a lot of different files 129 + gnutls # common/net_ssl_gnutls.c 130 + openexr # client/image.c 131 + 132 + (placeholder "out") 133 + ] ++ lib.optional enableWayland wayland ++ lib.optional enableVulkan vulkan-loader; 134 + in 135 + '' 136 + wrapProgram $out/bin/fteqw \ 137 + --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath libs}" 138 + ''; 139 + 140 + meta = { 141 + description = "Nazi Zombies: Portable's fork of Spike's FTEQW engine/client"; 142 + longDescription = '' 143 + This package contains only the FTEQW engine, and none of the assets used in NZ:P. 144 + Please use the `nzportable` package for an out-of-the-box NZ:P experience. 145 + 146 + FTEQW supports several graphics options. 147 + You can specify those graphics option by overriding the FTEQW package, like this: 148 + ```nix 149 + nzp-fteqw.override { 150 + enableVulkan = true; 151 + } 152 + ``` 153 + And in the game, you need to run `setrenderer <renderer>` to change the current renderer. 154 + 155 + Supported graphics options are as follows: 156 + - `enableEGL`: Enable the OpenGL ES renderer (`egl`). Enabled by default. 157 + - `enableVulkan`: Enable the Vulkan renderer (`xvk`). Enabled by default. 158 + - `enableWayland`: Enable native Wayland support, instead of using X11. 159 + Adds up to two renderers, based on whether EGL and Vulkan are installed: `wlgl` and `wlvk`. 160 + Seems to be currently broken and currently not enabled by default. 161 + ''; 162 + homepage = "https://github.com/nzp-team/fteqw"; 163 + license = lib.licenses.gpl2Plus; 164 + # See README 165 + platforms = [ 166 + "x86_64-linux" 167 + "i686-linux" 168 + "armv7l-linux" 169 + "aarch64-linux" 170 + "x86_64-windows" 171 + "i686-windows" 172 + ]; 173 + maintainers = with lib.maintainers; [ pluiedev ]; 174 + mainProgram = "fteqw"; 175 + }; 176 + })
+84
pkgs/by-name/nz/nzportable/package.nix
··· 1 + { 2 + lib, 3 + callPackage, 4 + writeShellApplication, 5 + }: 6 + let 7 + assets = callPackage ./assets.nix { }; 8 + quakec = callPackage ./quakec.nix { }; 9 + fteqw = callPackage ./fteqw.nix { }; 10 + 11 + # We use the youngest version of all of the dependencies as the version number. 12 + # This is similar to what upstream uses, except ours is a bit more accurate 13 + # since we don't rely on a CI to run at an arbitrary time. 14 + dateString = 15 + lib.pipe 16 + [ 17 + assets 18 + fteqw 19 + quakec 20 + ] 21 + [ 22 + # Find the youngest (most recently updated) version 23 + (lib.foldl' (acc: p: if lib.versionOlder acc p.version then p.version else acc) "") 24 + (lib.splitString "-") 25 + (lib.sublist 2 6) # drop the first two segments (0 and unstable) and only keep the date 26 + lib.concatStrings 27 + ]; 28 + 29 + version = "2.0.0-indev+${dateString}"; 30 + in 31 + writeShellApplication { 32 + name = "nzportable"; 33 + 34 + text = '' 35 + runDir=''${XDG_DATA_HOME:-$HOME/.local/share}/nzportable 36 + data=${assets.pc} 37 + 38 + relinkGameFiles() { 39 + mkdir -p "$runDir"/nzp 40 + 41 + # Remove existing links 42 + find "$runDir" -type l -exec rm {} + 43 + 44 + # Link game files 45 + ln -s $data/default.fmf "$runDir" 46 + ln -st "$runDir"/nzp $data/nzp/* ${quakec.fte}/* 47 + 48 + # Write current version 49 + echo "${version}" > "$runDir"/nzp/version.txt 50 + } 51 + 52 + if [[ ! -d $runDir ]]; then 53 + echo "Game directory $runDir not found. Assuming first launch" 54 + echo "Linking game files" 55 + relinkGameFiles 56 + else 57 + currentVersion=$(<"$runDir"/nzp/version.txt) 58 + if [[ "${version}" != "$currentVersion" ]]; then 59 + echo "Version mismatch! (saved version $currentVersion != current version ${version})" 60 + echo "Relinking game files" 61 + relinkGameFiles 62 + fi 63 + fi 64 + 65 + exec ${lib.getExe fteqw} -basedir "$runDir" "$@" 66 + ''; 67 + 68 + derivationArgs = { 69 + inherit version; 70 + passthru = { 71 + updateScript = callPackage ./update.nix { }; 72 + inherit assets quakec fteqw; 73 + }; 74 + }; 75 + 76 + meta = { 77 + inherit (fteqw.meta) platforms; 78 + description = "Call of Duty: Zombies demake, powered by various Quake sourceports (PC version)"; 79 + homepage = "https://docs.nzp.gay"; 80 + license = lib.licenses.gpl2Plus; 81 + maintainers = with lib.maintainers; [ pluiedev ]; 82 + mainProgram = "nzportable"; 83 + }; 84 + }
+64
pkgs/by-name/nz/nzportable/quakec.nix
··· 1 + { 2 + lib, 3 + stdenvNoCC, 4 + fetchFromGitHub, 5 + python3, 6 + nzportable, 7 + }: 8 + stdenvNoCC.mkDerivation { 9 + pname = "nzp-quakec"; 10 + version = "0-unstable-2024-10-12-12-03-59"; 11 + 12 + src = fetchFromGitHub { 13 + owner = "nzp-team"; 14 + repo = "quakec"; 15 + rev = "01e95c4dab91ce0e8b7387d2726d9ee307792ae7"; 16 + hash = "sha256-h4llx3tzeoI1aHLokM7NqkZJWuo6rcrmWfb0pDQL+zM="; 17 + }; 18 + 19 + outputs = [ 20 + "out" 21 + "fte" 22 + ]; 23 + 24 + nativeBuildInputs = [ python3 ]; 25 + 26 + buildInputs = with python3.pkgs; [ 27 + colorama 28 + fastcrc 29 + pandas 30 + nzportable.fteqw 31 + ]; 32 + 33 + buildPhase = '' 34 + runHook preBuild 35 + 36 + python3 bin/qc_hash_generator.py -i tools/asset_conversion_table.csv -o source/server/hash_table.qc 37 + 38 + mkdir -p build/{fte,standard} 39 + 40 + fteqcc -srcfile progs/csqc.src 41 + fteqcc -O3 -DFTE -srcfile progs/ssqc.src 42 + fteqcc -O3 -srcfile progs/ssqc.src 43 + 44 + runHook postBuild 45 + ''; 46 + 47 + installPhase = '' 48 + runHook preInstall 49 + 50 + mkdir -p $out $fte 51 + cp -r build/standard/* $out 52 + cp -r build/fte/* $fte 53 + 54 + runHook postInstall 55 + ''; 56 + 57 + meta = { 58 + description = "QuakeC repository for Nazi Zombies: Portable"; 59 + homepage = "https://github.com/nzp-team/quakec"; 60 + license = lib.licenses.gpl2Plus; 61 + platforms = with lib.platforms; linux ++ darwin; 62 + maintainers = with lib.maintainers; [ pluiedev ]; 63 + }; 64 + }
+41
pkgs/by-name/nz/nzportable/update.nix
··· 1 + { 2 + lib, 3 + writeShellApplication, 4 + jq, 5 + curl, 6 + nix-prefetch-git, 7 + common-updater-scripts, 8 + }: 9 + 10 + lib.getExe (writeShellApplication { 11 + name = "nzp-updater"; 12 + runtimeInputs = [ 13 + jq 14 + curl 15 + nix-prefetch-git 16 + common-updater-scripts 17 + ]; 18 + text = '' 19 + youngest=0 20 + update() { 21 + repo=$1 22 + tag=$2 23 + 24 + prefetch=$(nix-prefetch-git "https://github.com/nzp-team/$repo" --rev "$tag") 25 + 26 + timestamp=$(echo "$prefetch" | jq -r '.date | strptime("%Y-%m-%dT%H:%M:%S%z") | mktime | strftime("%Y-%m-%d-%H-%M-%S")') 27 + rev=$(echo "$prefetch" | jq -r ".rev") 28 + hash=$(echo "$prefetch" | jq -r ".hash") 29 + 30 + if [[ $youngest -lt $timestamp ]]; then 31 + youngest=$timestamp 32 + fi 33 + 34 + update-source-version "$UPDATE_NIX_ATTR_PATH.$repo" "0-unstable-$timestamp" "$hash" --rev="$rev" 35 + } 36 + 37 + update fteqw bleeding-edge 38 + update assets newest 39 + update quakec bleeding-edge 40 + ''; 41 + })
+59
pkgs/development/python-modules/fastcrc/default.nix
··· 1 + { 2 + lib, 3 + buildPythonPackage, 4 + pythonOlder, 5 + fetchFromGitHub, 6 + rustPlatform, 7 + pytestCheckHook, 8 + pytest-benchmark, 9 + nix-update-script, 10 + }: 11 + let 12 + pname = "fastcrc"; 13 + version = "0.3.2"; 14 + 15 + src = fetchFromGitHub { 16 + owner = "overcat"; 17 + repo = "fastcrc"; 18 + rev = "refs/tags/v${version}"; 19 + hash = "sha256-yLrv/zqsjgygJAIJtztwxlm4s9o9EBVsCyx1jUXd7hA="; 20 + }; 21 + in 22 + buildPythonPackage { 23 + inherit pname version src; 24 + pyproject = true; 25 + 26 + disabled = pythonOlder "3.7"; 27 + 28 + nativeBuildInputs = with rustPlatform; [ 29 + cargoSetupHook 30 + maturinBuildHook 31 + ]; 32 + 33 + cargoDeps = rustPlatform.fetchCargoTarball { 34 + inherit src; 35 + name = "${pname}-${version}"; 36 + hash = "sha256-wSE7548L+ymNjN9TfygAGY1BrssXOPGXlmE83wV7zb4="; 37 + }; 38 + 39 + pythonImportsCheck = [ "fastcrc" ]; 40 + 41 + nativeCheckInputs = [ 42 + pytestCheckHook 43 + pytest-benchmark 44 + ]; 45 + 46 + # Python source files interfere with testing 47 + preCheck = '' 48 + rm -r fastcrc 49 + ''; 50 + 51 + passthru.updateScript = nix-update-script { }; 52 + 53 + meta = { 54 + description = "Hyper-fast Python module for computing CRC(8, 16, 32, 64) checksum"; 55 + homepage = "https://fastcrc.readthedocs.io/en/latest/"; 56 + license = lib.licenses.mit; 57 + maintainers = with lib.maintainers; [ pluiedev ]; 58 + }; 59 + }
+2
pkgs/top-level/python-packages.nix
··· 4382 4382 4383 4383 fastapi-sso = callPackage ../development/python-modules/fastapi-sso { }; 4384 4384 4385 + fastcrc = callPackage ../development/python-modules/fastcrc { }; 4386 + 4385 4387 fast-histogram = callPackage ../development/python-modules/fast-histogram { }; 4386 4388 4387 4389 fastavro = callPackage ../development/python-modules/fastavro { };