Simplify something
This commit is contained in:
parent
b896a064f4
commit
3f0a235dc8
7 changed files with 4 additions and 11 deletions
19
extras/overlays.nix
Normal file
19
extras/overlays.nix
Normal file
|
@ -0,0 +1,19 @@
|
|||
# This file defines overlays
|
||||
{inputs, ...}: {
|
||||
# This one brings our custom packages from the 'pkgs' directory
|
||||
additions = final: _prev: import ./pkgs {pkgs = final;};
|
||||
|
||||
# This one contains whatever you want to overlay
|
||||
selfsuper = (self: super: {
|
||||
mpv = super.mpv.override {
|
||||
scripts = with self.mpvScripts; [mpris sponsorblock thumbnail];
|
||||
};
|
||||
});
|
||||
|
||||
finalprev = (final: prev: {
|
||||
unstable = import inputs.nixpkgs-unstable {
|
||||
system = final.system;
|
||||
config.allowUnfree = true;
|
||||
};
|
||||
});
|
||||
}
|
5
extras/pkgs/default.nix
Normal file
5
extras/pkgs/default.nix
Normal file
|
@ -0,0 +1,5 @@
|
|||
# Custom packages, that can be defined similarly to nixpkgs
|
||||
{pkgs, ...}: {
|
||||
xash3d = pkgs.callPackage ./xash/xash3d.nix {};
|
||||
hlsdk = pkgs.callPackage ./xash/hlsdk.nix {};
|
||||
}
|
17
extras/pkgs/xash/change-zip-date.patch
Normal file
17
extras/pkgs/xash/change-zip-date.patch
Normal file
|
@ -0,0 +1,17 @@
|
|||
diff --git a/scripts/waifulib/zip.py b/scripts/waifulib/zip.py
|
||||
index 6e903ba7..d47f1754 100644
|
||||
--- a/scripts/waifulib/zip.py
|
||||
+++ b/scripts/waifulib/zip.py
|
||||
@@ -25,7 +25,11 @@ class ziparchive(Task.Task):
|
||||
arcfile = src.path_from(self.relative_to)
|
||||
|
||||
Logs.debug('%s: %s <- %s as %s', self.__class__.__name__, outfile, infile, arcfile)
|
||||
- zf.write(infile, arcfile)
|
||||
+
|
||||
+ arcfile = zipfile.ZipInfo(filename=arcfile, date_time=(1980, 1, 1, 0, 0, 0))
|
||||
+
|
||||
+ with open(infile, 'rb') as f:
|
||||
+ zf.writestr(arcfile, f.read())
|
||||
|
||||
@TaskGen.feature('zip')
|
||||
def create_zip_archive(self):
|
52
extras/pkgs/xash/hlsdk.nix
Normal file
52
extras/pkgs/xash/hlsdk.nix
Normal file
|
@ -0,0 +1,52 @@
|
|||
{ lib
|
||||
, pkgs
|
||||
, stdenv
|
||||
, fetchFromGitHub
|
||||
, gamedir ? "valve"
|
||||
, enableGoldsourceSupport ? true
|
||||
, enableVgui ? false
|
||||
, enableVoicemgr ? false
|
||||
, enableBugfixes ? false
|
||||
, enableCrowbarIdleAnim ? false
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
pname = "fwgs-hlsdk";
|
||||
version = "2023-03-01";
|
||||
|
||||
nativeBuildInputs = with pkgs; [cmake];
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "FWGS";
|
||||
repo = "hlsdk-portable";
|
||||
rev = "d11f853464ee5d951e25ce9d0eea001780b92196";
|
||||
sha256 = if enableVgui then "sha256-Qd+SUie+jlfxo6aefordYw665ZaNaR3TxufntfIaoCo=" else "sha256-WU+I+mmoyXvW1pvqJLddPaA8/tod3TtvqzVPYJRbGz4=";
|
||||
fetchSubmodules = enableVgui;
|
||||
};
|
||||
|
||||
cmakeFlags = let
|
||||
optionals = lib.optionals;
|
||||
optional = (cond: val: optionals cond [val]);
|
||||
cmakeBool = (x: if x then "ON" else "OFF");
|
||||
in [
|
||||
"-DUSE_VGUI=${cmakeBool enableVgui}"
|
||||
"-DGOLDSOURCE_SUPPORT=${cmakeBool enableGoldsourceSupport}"
|
||||
"-DUSE_VOICEMGR=${cmakeBool enableVoicemgr}"
|
||||
"-DBARNACLE_FIX_VISIBILITY=${cmakeBool enableBugfixes}"
|
||||
"-DCROWBAR_DELAY_FIX=${cmakeBool enableBugfixes}"
|
||||
"-DCROWBAR_FIX_RAPID_CROWBAR=${cmakeBool enableBugfixes}"
|
||||
"-DGAUSS_OVERCHARGE_FIX=${cmakeBool enableBugfixes}"
|
||||
"-DTRIPMINE_BEAM_DUPLICATION_FIX=${cmakeBool enableBugfixes}"
|
||||
"-DHANDGRENADE_DEPLOY_FIX=${cmakeBool enableBugfixes}"
|
||||
"-DWEAPONS_ANIMATION_TIMES_FIX=${cmakeBool enableBugfixes}"
|
||||
"-DCROWBAR_IDLE_ANIM=${cmakeBool enableCrowbarIdleAnim}"
|
||||
] ++ (optional (gamedir != "valve") "-DGAMEDIR=${gamedir}")
|
||||
++ (optional stdenv.is64bit "-D64BIT=ON");
|
||||
|
||||
meta = with lib; {
|
||||
description = "Portable Half-Life SDK. GoldSource and Xash3D. Crossplatform.";
|
||||
homepage = "https://github.com/FWGS/hlsdk-portable";
|
||||
license = with licenses; [ unfree ];
|
||||
# maintainers = with maintainers; [ chayleaf ];
|
||||
};
|
||||
}
|
68
extras/pkgs/xash/xash3d.nix
Normal file
68
extras/pkgs/xash/xash3d.nix
Normal file
|
@ -0,0 +1,68 @@
|
|||
{ lib
|
||||
, pkgs
|
||||
, stdenv
|
||||
, fetchFromGitHub
|
||||
, dedicated ? false # dedicated server
|
||||
, gamedir ? "valve"
|
||||
, enableBsp2 ? false # bsp2 support (for quake)
|
||||
, enableGles1 ? false # gles1 renderer (nanogl)
|
||||
, enableGles2 ? false # gles2 renderer (glwes)
|
||||
, enableGl4es ? false # gles2 renderer (gl4es)
|
||||
, enableGl ? true # opengl renderer
|
||||
, enableSoft ? true # soft renderer
|
||||
, enableUtils ? false # mdldec
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
pname = "xash3d-fwgs";
|
||||
version = "2023-03-01";
|
||||
|
||||
nativeBuildInputs = with pkgs; [python3 pkg-config makeWrapper];
|
||||
buildInputs = with pkgs; [SDL2 libopus freetype fontconfig];
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "FWGS";
|
||||
repo = "xash3d-fwgs";
|
||||
rev = "7e9d46689ca76d6bf1669ada6344fc724dd683cf";
|
||||
sha256 = "sha256-rvONYm1Gz9PpK8KY6RIIJ82FtxGcWe/4YoT2eV4sCOc=";
|
||||
fetchSubmodules = true;
|
||||
};
|
||||
patches = [ ./change-zip-date.patch ];
|
||||
|
||||
configurePhase = let
|
||||
optionals = lib.optionals;
|
||||
optional = (cond: val: optionals cond [val]);
|
||||
flags = ["-8" "-P" "--prefix=/"]
|
||||
++ (optional dedicated "-d")
|
||||
++ (optionals (gamedir != "valve") ["--gamedir" gamedir])
|
||||
++ (optional enableBsp2 "--enable-bsp2")
|
||||
++ (optional enableGles1 "--enable-gles1")
|
||||
++ (optional enableGles2 "--enable-gles2")
|
||||
++ (optional enableGl4es "--enable-gl4es")
|
||||
++ (optional (!enableGl) "--disable-gl")
|
||||
++ (optional (!enableSoft) "--disable-soft")
|
||||
++ (optional enableUtils "--enable-utils")
|
||||
;
|
||||
in ''
|
||||
python3 ./waf configure -T release ${lib.strings.escapeShellArgs flags}
|
||||
'';
|
||||
|
||||
buildPhase = ''
|
||||
python3 ./waf build
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
python3 ./waf install "--destdir=$out"
|
||||
mkdir $out/bin
|
||||
makeWrapper $out/lib/xash3d/xash3d $out/bin/xash3d --set XASH3D_EXTRAS_PAK1 $out/share/xash3d/valve/extras.pk3
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "Xash3D FWGS engine";
|
||||
homepage = "https://github.com/FWGS/xash3d-fwgs";
|
||||
# this is a mess because of vendoring...
|
||||
# maybe the correct thing to do use to simply use `[ unfree gpl3Plus ]` instead
|
||||
license = with licenses; [ unfree gpl2Plus gpl3Plus lgpl3Plus mit bsd3 ];
|
||||
# maintainers = with maintainers; [ chayleaf ];
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue