about summary refs log tree commit diff
path: root/pkgs/by-name/et
diff options
context:
space:
mode:
authorPol Dellaiera <pol.dellaiera@protonmail.com>2024-03-17 21:40:03 +0100
committerPol Dellaiera <pol.dellaiera@protonmail.com>2024-04-04 08:21:51 +0200
commite1839caba396d9e54431d41d1e9fd8ed4dfbe988 (patch)
treee60fe69e856b0d6067809ac1c66f4b473b81aa62 /pkgs/by-name/et
parent72f0780e4eb942fc3976cfaa2b1d45fb7ee0cd29 (diff)
etlegacy-unwrapped: init at 2.82.0, etlegacy: refactor
Diffstat (limited to 'pkgs/by-name/et')
-rw-r--r--pkgs/by-name/et/etlegacy-assets/package.nix52
-rw-r--r--pkgs/by-name/et/etlegacy-unwrapped/package.nix114
-rw-r--r--pkgs/by-name/et/etlegacy/package.nix134
3 files changed, 183 insertions, 117 deletions
diff --git a/pkgs/by-name/et/etlegacy-assets/package.nix b/pkgs/by-name/et/etlegacy-assets/package.nix
new file mode 100644
index 0000000000000..51c5b16d3277d
--- /dev/null
+++ b/pkgs/by-name/et/etlegacy-assets/package.nix
@@ -0,0 +1,52 @@
+{ lib
+, stdenv
+, fetchurl
+}:
+
+stdenv.mkDerivation {
+  pname = "etlegacy-assets";
+  version = "2.82.0";
+
+  srcs = let
+    fetchAsset = { asset, hash }: fetchurl {
+      url = "https://mirror.etlegacy.com/etmain/${asset}";
+      inherit hash;
+    };
+  in [
+    (fetchAsset {
+      asset = "pak0.pk3";
+      hash = "sha256-cSlmsg4GUj/oFBlRZQDkmchrK0/sgjhW3b0zP8s9JuU=";
+    })
+    (fetchAsset {
+      asset = "pak1.pk3";
+      hash = "sha256-VhD9dJAkQFtEJafOY5flgYe5QdIgku8R1IRLQn31Pl0=";
+    })
+    (fetchAsset {
+      asset = "pak2.pk3";
+      hash = "sha256-pIq3SaGhKrTZE3KGsfI9ZCwp2lmEWyuvyPZOBSzwbz4=";
+    })
+  ];
+
+  sourceRoot = ".";
+  unpackCmd = "cp -r $curSrc \${curSrc##*-}";
+
+  installPhase = ''
+    runHook preInstall
+    mkdir -p $out/lib/etlegacy/etmain
+    cp -r . $out/lib/etlegacy/etmain/
+    runHook postInstall
+  '';
+
+  meta = {
+    description = "ET: Legacy assets only";
+    homepage = "https://etlegacy.com";
+    license = with lib.licenses; [ cc-by-nc-sa-30 ];
+    longDescription = ''
+      ET: Legacy, an open source project fully compatible client and server
+      for the popular online FPS game Wolfenstein: Enemy Territory - whose
+      gameplay is still considered unmatched by many, despite its great age.
+    '';
+    maintainers = with lib.maintainers; [ drupol ];
+    platforms = lib.platforms.linux;
+  };
+}
diff --git a/pkgs/by-name/et/etlegacy-unwrapped/package.nix b/pkgs/by-name/et/etlegacy-unwrapped/package.nix
new file mode 100644
index 0000000000000..8bacd93e1a2b0
--- /dev/null
+++ b/pkgs/by-name/et/etlegacy-unwrapped/package.nix
@@ -0,0 +1,114 @@
+{ lib
+, stdenv
+, writeShellApplication
+, fetchFromGitHub
+, cjson
+, cmake
+, git
+, makeBinaryWrapper
+, unzip
+, curl
+, freetype
+, glew
+, libjpeg
+, libogg
+, libpng
+, libtheora
+, lua5_4
+, minizip
+, openal
+, SDL2
+, sqlite
+, zlib
+}:
+let
+  version = "2.82.0";
+  fakeGit = writeShellApplication {
+    name = "git";
+
+    text = ''
+      if [ "$1" = "describe" ]; then
+        echo "${version}"
+      fi
+    '';
+  };
+in
+stdenv.mkDerivation {
+  pname = "etlegacy-unwrapped";
+  inherit version;
+
+  src = fetchFromGitHub {
+    owner = "etlegacy";
+    repo = "etlegacy";
+    rev = "refs/tags/v${version}";
+    hash = "sha256-yNVVEa+3+Swm3hgwm9cSLV0K88E37TgVVjh1uUl8O2o=";
+  };
+
+  nativeBuildInputs = [
+    cjson
+    cmake
+    fakeGit
+    git
+    makeBinaryWrapper
+    unzip
+  ];
+
+  buildInputs = [
+    curl
+    freetype
+    glew
+    libjpeg
+    libogg
+    libpng
+    libtheora
+    lua5_4
+    minizip
+    openal
+    SDL2
+    sqlite
+    zlib
+  ];
+
+  preBuild = ''
+    # Required for build time to not be in 1980
+    export SOURCE_DATE_EPOCH=$(date +%s)
+    # This indicates the build was by a CI pipeline and prevents the resource
+    # files from being flagged as 'dirty' due to potentially being custom built.
+    export CI="true"
+  '';
+
+  cmakeFlags = [
+    "-DCROSS_COMPILE32=0"
+    "-DBUILD_SERVER=1"
+    "-DBUILD_CLIENT=1"
+    "-DBUNDLED_JPEG=0"
+    "-DBUNDLED_LIBS=0"
+    "-DINSTALL_EXTRA=0"
+    "-DINSTALL_OMNIBOT=0"
+    "-DINSTALL_GEOIP=0"
+    "-DINSTALL_WOLFADMIN=0"
+    "-DFEATURE_AUTOUPDATE=0"
+    "-DINSTALL_DEFAULT_BASEDIR=${placeholder "out"}/lib/etlegacy"
+    "-DINSTALL_DEFAULT_BINDIR=${placeholder "out"}/bin"
+  ];
+
+  postInstall = ''
+    makeWrapper $out/bin/etl.* $out/bin/etl
+    makeWrapper $out/bin/etlded.* $out/bin/etlded
+  '';
+
+  hardeningDisable = [ "fortify" ];
+
+  meta = {
+    description = "ET: Legacy is an open source project based on the code of Wolfenstein: Enemy Territory which was released in 2010 under the terms of the GPLv3 license";
+    homepage = "https://etlegacy.com";
+    license = with lib.licenses; [ gpl3Plus ];
+    longDescription = ''
+      ET: Legacy, an open source project fully compatible client and server
+      for the popular online FPS game Wolfenstein: Enemy Territory - whose
+      gameplay is still considered unmatched by many, despite its great age.
+    '';
+    maintainers = with lib.maintainers; [ ashleyghooper drupol ];
+    platforms = lib.platforms.linux;
+  };
+}
diff --git a/pkgs/by-name/et/etlegacy/package.nix b/pkgs/by-name/et/etlegacy/package.nix
index 8e5c53eb0d2b6..6e3837a4a9b1d 100644
--- a/pkgs/by-name/et/etlegacy/package.nix
+++ b/pkgs/by-name/et/etlegacy/package.nix
@@ -1,134 +1,34 @@
 { lib
-, stdenv
-, fetchurl
-, writeShellApplication
-, fetchFromGitHub
-, cjson
-, cmake
-, git
+, symlinkJoin
+, etlegacy-assets
+, etlegacy-unwrapped
 , makeBinaryWrapper
-, unzip
-, curl
-, freetype
-, glew
-, libjpeg
-, libogg
-, libpng
-, libtheora
-, lua5_4
-, minizip
-, openal
-, SDL2
-, sqlite
-, zlib
 }:
-let
-  version = "2.82.0";
-
-  fetchAsset = { asset, hash }: fetchurl {
-    url = "https://mirror.etlegacy.com/etmain/${asset}";
-    inherit hash;
-  };
-
-  pak0 = fetchAsset {
-    asset = "pak0.pk3";
-    hash = "sha256-cSlmsg4GUj/oFBlRZQDkmchrK0/sgjhW3b0zP8s9JuU=";
-  };
-
-  pak1 = fetchAsset {
-    asset = "pak1.pk3";
-    hash = "sha256-VhD9dJAkQFtEJafOY5flgYe5QdIgku8R1IRLQn31Pl0=";
-  };
-
-  pak2 = fetchAsset {
-    asset = "pak2.pk3";
-    hash = "sha256-pIq3SaGhKrTZE3KGsfI9ZCwp2lmEWyuvyPZOBSzwbz4=";
-  };
-
-  fakeGit = writeShellApplication {
-    name = "git";
-
-    text = ''
-      if [ "$1" = "describe" ]; then
-        echo "${version}"
-      fi
-    '';
-  };
-in
-stdenv.mkDerivation {
-  pname = "etlegacy";
-  inherit version;
 
-  src = fetchFromGitHub {
-    owner = "etlegacy";
-    repo = "etlegacy";
-    rev = "refs/tags/v${version}";
-    hash = "sha256-yNVVEa+3+Swm3hgwm9cSLV0K88E37TgVVjh1uUl8O2o=";
-  };
+symlinkJoin {
+  name = "etlegacy";
+  version = "2.82.0";
+  paths = [
+    etlegacy-assets
+    etlegacy-unwrapped
+  ];
 
   nativeBuildInputs = [
-    cjson
-    cmake
-    fakeGit
-    git
     makeBinaryWrapper
-    unzip
-  ];
-
-  buildInputs = [
-    curl
-    freetype
-    glew
-    libjpeg
-    libogg
-    libpng
-    libtheora
-    lua5_4
-    minizip
-    openal
-    SDL2
-    sqlite
-    zlib
   ];
 
-  preBuild = ''
-    # Required for build time to not be in 1980
-    export SOURCE_DATE_EPOCH=$(date +%s)
-    # This indicates the build was by a CI pipeline and prevents the resource
-    # files from being flagged as 'dirty' due to potentially being custom built.
-    export CI="true"
+  postBuild = ''
+    rm -rf $out/bin/*
+    makeWrapper ${etlegacy-unwrapped}/bin/etl.* $out/bin/etl \
+      --add-flags "+set fs_basepath ${placeholder "out"}/lib/etlegacy"
+    makeWrapper ${etlegacy-unwrapped}/bin/etlded.* $out/bin/etlded \
+      --add-flags "+set fs_basepath ${placeholder "out"}/lib/etlegacy"
   '';
 
-  cmakeFlags = [
-    "-DCROSS_COMPILE32=0"
-    "-DBUILD_SERVER=1"
-    "-DBUILD_CLIENT=1"
-    "-DBUNDLED_JPEG=0"
-    "-DBUNDLED_LIBS=0"
-    "-DINSTALL_EXTRA=0"
-    "-DINSTALL_OMNIBOT=0"
-    "-DINSTALL_GEOIP=0"
-    "-DINSTALL_WOLFADMIN=0"
-    "-DFEATURE_AUTOUPDATE=0"
-    "-DINSTALL_DEFAULT_BASEDIR=${placeholder "out"}/lib/etlegacy"
-    "-DINSTALL_DEFAULT_BINDIR=${placeholder "out"}/bin"
-  ];
-
-  postInstall = ''
-    ln -s ${pak0} $out/lib/etlegacy/etmain/pak0.pk3
-    ln -s ${pak1} $out/lib/etlegacy/etmain/pak1.pk3
-    ln -s ${pak2} $out/lib/etlegacy/etmain/pak2.pk3
-
-    makeWrapper $out/bin/etl.* $out/bin/etl
-    makeWrapper $out/bin/etlded.* $out/bin/etlded
-  '';
-
-  hardeningDisable = [ "fortify" ];
-
   meta = {
     description = "ET: Legacy is an open source project based on the code of Wolfenstein: Enemy Territory which was released in 2010 under the terms of the GPLv3 license";
     homepage = "https://etlegacy.com";
-    license = with lib.licenses; [ gpl3Plus ];
+    license = with lib.licenses; [ gpl3Plus cc-by-nc-sa-30 ];
     longDescription = ''
       ET: Legacy, an open source project fully compatible client and server
       for the popular online FPS game Wolfenstein: Enemy Territory - whose