From dbcc734bbd3bd1ef1f3cee11aa72452d498db745 Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Sat, 19 Aug 2023 06:47:53 +0200 Subject: [PATCH 1/2] ioquake3: cleanup - Fix `ioquake3` - Remove the arch suffix from the binaries (`ioquake3.x86-64` -> `ioquake3`, `ioq3ded.x86-64` -> `ioq3ded`) - Add `.desktop` file - Remove unneeded dependencies - Clean-up installation phase - Add `meta.mainProgram` attribute - Add myself in the maintainer list --- pkgs/games/quake3/ioquake/default.nix | 58 ++++++++++++++++++--------- 1 file changed, 39 insertions(+), 19 deletions(-) diff --git a/pkgs/games/quake3/ioquake/default.nix b/pkgs/games/quake3/ioquake/default.nix index f0d8ea56693bbe..73ee3bbb86a85c 100644 --- a/pkgs/games/quake3/ioquake/default.nix +++ b/pkgs/games/quake3/ioquake/default.nix @@ -1,47 +1,52 @@ { lib , stdenv , fetchFromGitHub -, which , pkg-config +, which +, copyDesktopItems +, makeBinaryWrapper , SDL2 , libGL -, openalSoft +, openal , curl , speex , opusfile , libogg , libvorbis -, libopus , libjpeg -, mumble +, makeDesktopItem , freetype }: stdenv.mkDerivation { pname = "ioquake3"; - version = "unstable-2022-11-24"; + version = "unstable-2023-08-13"; src = fetchFromGitHub { owner = "ioquake"; repo = "ioq3"; - rev = "70d07d91d62dcdd2f2268d1ac401bfb697b4c991"; - sha256 = "sha256-WDjR0ik+xAs6OA1DNbUGIF1MXSuEoy8nNkPiHaegfF0="; + rev = "ee950eb7b0e41437cc23a9943254c958da8a61ab"; + sha256 = "sha256-NfhInwrtw85i2mnv7EtBrrpNaslaQaVhLNlK0I9aYto="; }; - nativeBuildInputs = [ which pkg-config ]; + nativeBuildInputs = [ + copyDesktopItems + makeBinaryWrapper + pkg-config + which + ]; + buildInputs = [ SDL2 libGL - openalSoft + openal curl speex opusfile libogg libvorbis - libopus libjpeg freetype - mumble ]; enableParallelBuilding = true; @@ -50,17 +55,32 @@ stdenv.mkDerivation { installTargets = [ "copyfiles" ]; - installFlags = [ "COPYDIR=$(out)" "COPYBINDIR=$(out)/bin" ]; + installFlags = [ "COPYDIR=$(out)/share/ioquake3" ]; - preInstall = '' - mkdir -p $out/baseq3 $out/bin + postInstall = '' + install -Dm644 misc/quake3.svg $out/share/icons/hicolor/scalable/apps/ioquake3.svg + + makeWrapper $out/share/ioquake3/ioquake3.* $out/bin/ioquake3 + makeWrapper $out/share/ioquake3/ioq3ded.* $out/bin/ioq3ded ''; - meta = with lib; { + desktopItems = [ + (makeDesktopItem { + name = "IOQuake3"; + exec = "ioquake3"; + icon = "ioquake3"; + comment = "A fast-paced 3D first-person shooter, a community effort to continue supporting/developing id's Quake III Arena"; + desktopName = "ioquake3"; + categories = [ "Game" "ActionGame" ]; + }) + ]; + + meta = { homepage = "https://ioquake3.org/"; - description = "First person shooter engine based on the Quake 3: Arena and Quake 3: Team Arena"; - license = licenses.gpl2Only; - platforms = platforms.linux; - maintainers = with maintainers; [ rvolosatovs eelco abbradar ]; + description = "A fast-paced 3D first-person shooter, a community effort to continue supporting/developing id's Quake III Arena"; + license = lib.licenses.gpl2Only; + mainProgram = "ioquake3"; + maintainers = with lib.maintainers; [ abbradar drupol eelco rvolosatovs ]; + platforms = lib.platforms.linux; }; } From 5fdff213c9ac02b2ad79f6c42de7deb77a6cd8ac Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Sat, 19 Aug 2023 06:48:13 +0200 Subject: [PATCH 2/2] nixos/quake3-server: add `package` config option - Remove top-level `with lib;` --- nixos/modules/services/games/quake3-server.nix | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/nixos/modules/services/games/quake3-server.nix b/nixos/modules/services/games/quake3-server.nix index 2d2148237da165..e51830c12e7881 100644 --- a/nixos/modules/services/games/quake3-server.nix +++ b/nixos/modules/services/games/quake3-server.nix @@ -1,13 +1,15 @@ { config, pkgs, lib, ... }: -with lib; let + inherit (lib) literalMD mkEnableOption mkIf mkOption types; cfg = config.services.quake3-server; + configFile = pkgs.writeText "q3ds-extra.cfg" '' set net_port ${builtins.toString cfg.port} ${cfg.extraConfig} ''; + defaultBaseq3 = pkgs.requireFile rec { name = "baseq3"; hashMode = "recursive"; @@ -25,6 +27,7 @@ let $services.quake3-server.baseq3/.q3a/ ''; }; + home = pkgs.runCommand "quake3-home" {} '' mkdir -p $out/.q3a/baseq3 @@ -38,6 +41,7 @@ in { options = { services.quake3-server = { enable = mkEnableOption (lib.mdDoc "Quake 3 dedicated server"); + package = lib.mkPackageOptionMD pkgs "ioquake3" { }; port = mkOption { type = types.port; @@ -103,10 +107,10 @@ in { ReadOnlyPaths = if baseq3InStore then home else cfg.baseq3; ExecStartPre = optionalString (!baseq3InStore) "+${pkgs.coreutils}/bin/cp ${configFile} ${cfg.baseq3}/.q3a/baseq3/nix.cfg"; - ExecStart = "${pkgs.ioquake3}/ioq3ded.x86_64 +exec nix.cfg"; + ExecStart = "${cfg.package}/bin/ioq3ded +exec nix.cfg"; }; }; }; - meta.maintainers = with maintainers; [ f4814n ]; + meta.maintainers = with lib.maintainers; [ f4814n ]; }