-
-
Notifications
You must be signed in to change notification settings - Fork 15k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
xash3d: init at unstable-2023-06-13 #238392
base: master
Are you sure you want to change the base?
Conversation
dc67807
to
46e970e
Compare
Since this pull request is sitting here for a month already, I took the opportunity to update it. Initially I just wanted to update the version and do some small fixes as I saw there were some problems, but I did a lot more in the end. I discovered on my own how to remove this stupid hack where I symlink libraries in the half-life data files. That was one big thing bugging me. I found that there was yet someone else who tried to package xash3d: https://github.com/vs49688/nix-repo/tree/master/pkgs/xash3d-fwgs. With that i discovered that actually xash3d on 64bit can not only run half-life, but a lot of other games. The issue though is that each game needs its own version of the hlsdk and its own wrapper. I did this for 3 games: half-life, blue shit and opposing forces. If anyone wants more games I will do it later on request, but for now I want this to be merged. I just need help on one point. Right now my packages work, but I've put a lot of things in top-level/all-packages.nix and I feel it doesn't belong there. Moreover for each package I must specify the hlsdk and the wrapper, which ends up in duplications. I don't know how to deduplicate this though. So if anyone has a way, please tell me. |
46e970e
to
b3d52b0
Compare
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/prs-ready-for-review/3032/2445 |
if [ ! -d "$XASH3D_BASEDIR" ]; then | ||
echo "$XASH3D_BASEDIR not found" | ||
exit 1 | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The potential error should be catched in nix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Um no ? If you try to catch the error in Nix you're catching the error at build time. This is impossible because this here is a runtime error. If the directory $XASH3D_BASEDIR
doesn't exist at runtime there's an error, but this is fine at build time. Especially that $XASH3D_BASEDIR
can be changed by the user and so it can be anything at runtime.
pkgs/games/xash3d/wrapper.nix
Outdated
''; | ||
in symlinkJoin { | ||
name = "xash3d-${name}"; | ||
paths = [ wrapper ]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can just use runCommand or similar if we only symlink one thing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From what I understood runCommand is just for running a command once at build time. But this here is, as the file name suggests, a wrapper script that is run each time the game is run. I think I could also just use writeShellScriptBin directly, but the problem is that it doesn't have any meta attribute. And since the wrapper is what people are going to install in the end, it's important to have a meta with description and all that. Especially that in the longDescription I'm explaining how to run the game, important stuff that you can't just leave out. The only solution I found right now is symlinkJoin, but if you have a better one I'm interested.
b3d52b0
to
7a245b3
Compare
7a245b3
to
14104b5
Compare
14104b5
to
6753542
Compare
I took again the opportunity to make some changes:
|
6753542
to
08c68a3
Compare
I've just learned about the existence of |
Since this PR is staling I'm pinging those people who were trying too to package xash3d, in the hope that you guys don't mind: Also @necrophcodr you were interested in FreeHL, so you might be interested in xash3d too ? |
I know everything runs fine, I've completed all of the 3 games valve, bshift and gearbox, I just need someone who can confirm the desktop items work and some review on the nix files so that this PR gets merged. |
pkgs/games/xash3d/default.nix
Outdated
, enableGles1 ? false # gles1 renderer (nanogl) | ||
, enableGles2 ? false # gles2 renderer (glwes) | ||
, enableGl4es ? false # gles2 renderer (gl4es) | ||
, enableGl ? true # opengl renderer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really need all these flags? Have you tested all the cases? I distinctly remember having compile errors when trying to enable only what I needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't test them myself, true, I copied those from chayleaf's attempt. But I thought why not keep them if someone needs them one day
pkgs/games/xash3d/wrapper.nix
Outdated
description = "${fullname} running using the Xash3D engine, a GoldSrc reimplementation"; | ||
|
||
wrapper = writeShellScriptBin "xash3d-${name}" '' | ||
export XASH3D_EXTRAS_PAK1=${xash3d-unwrapped}/share/xash3d/valve/extras.pk3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should set XASH3D_RODIR
:
export XASH3D_RODIR="@out@/lib/xash3d"
I suggest substituting
this to $out/bin/xash3d
at install-time.
But then again, I'm biased ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why setting it ? First of all $XASH3D_RODIR
is the directory to the assets, so why should it be @out@/lib/xash3d
? When not specified it defaults to $XASH3D_BASEDIR
which is exactly what we want. $XASH3D_BASEDIR
is a directory to which Xash3D can write, it's where it puts screenshots for example. That's how the whole structure looks like:
$ tree -L 1 ~/.local/share/xash3d
~/.local/share/xash3d
├── bshift
├── gearbox
└── valve
$XASH3D_BASEDIR
and $XASH3D_RODIR
are both set to ~/.local/share/xash3d
.
@TheBrainScrambler I never attempted to upstream mine for two reasons:
That being said, I'm not sure I like the idea of having a per-game That's what I do in mine, and I create a new derivation with:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
arcfile = src.path_from(self.relative_to) | ||
|
||
Logs.debug('%s: %s <- %s as %s', self.__class__.__name__, outfile, infile, arcfile) | ||
- zf.write(infile, arcfile) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can usually change ZipFile
initialization to use strict_timestamps=False
instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand. Plus this patch comes from you here :p
Just set the license to unfree, that's what I did. I also put a comment there pointing to the related issue.
That's why to package this I avoided 2. Instead, you can build Xash3D without any problems, then you can put your assets in I don't understand why you would want sets of games instead of just allowing to install each game individually. So what you want is for example this:
Instead of just exposing valve, bshift and gearbox as individual packages, and letting the user choose which ones to install ? What's the point behind that ? Besides, you need to have one launcher per game. The key is this line in the wrapper:
with the flags:
(in retrospect this See, instead of copying the hlsdks dlls in the user's assets and thus putting garbage in there, instead I specify to xash3d the location of the dlls when I launch it. And since every game has a different hlsdk, you need one launcher per game. |
08c68a3
to
be1e352
Compare
So @vs49688 what do you think ? |
That's all possible. I did try running it with LD_DEBUG=libs and when it crashed, the following lines were output. If they're entirely related, I do not know, but it would definitely be a good indicator of the issue. If this is caused by this build process or not, I can't say for sure of course. Additionally, I'd like to point out that if it works for you, then it should surely also work on my end, bar any hardware related issues (which I do not believe this to be). Anyway, here's the output for posterity:
|
@TheBrainScrambler I've looked into the issues for a bit, not being very familiar with the codebase I was unable to find the root of the issue. If anyone manages to run it just fine on a clean system with the software renderer, then I'd definitely say keep it as is, otherwise it might be better to default that part to off? If you're able to test this on a machine that preferably hasn't had any related work done, or is a fresh install, and it works fine there, that's by far good enough of a confirmation that it is related to my setup, although I'm not aware of what exactly it could be when it seems to issue errors relating to the currently-not-built VGUI support. I should also point out that I do not have write permissions for this repository, so the above is merely my opinion. |
@necrophcodr I've tried running Xash3D with LD_DEBUG=libs too, and I get the exact same symbol lookup errors that you have with the software renderer, except that I don't get any crash. So there errors are unrelated to your crash. It's weird because Nix after all revolves about sandboxing and reproducible builds, normally I shouldn't have to get a clean install to test this ... I've built xash3d using nix-build so normally there should be no leak eh ? I'm going to default the software renderer to false, because there is a merge conflict I have to solve now anyway, and thinking about it I don't want to retest it if there is an update. I first thought about turning it back on by default if someone else can test it and confirm it works, but I don't think it's worth maintaining it in the long run. I don't think anyone will actually care about this. And if someone does he can just enable it with an override. If someone wants any of the renderers other than opengl enabled by default, let me know, I'm open to that. It shouldn't matter too much though since Hydra won't build this package anyway. |
7a8f511
to
da948c9
Compare
Personally I much prefer the software renderer, because it's closer to the original experience. But that's my own experience, so I approve of this decision! I've got nothing else to add, it looks decent to me. |
If you want it I can re-enable it by default, but for that we need that someone else tests the software renderer to see if it's just you or just me for which it works/doesn't. |
Oh no since it works for you and not for me, and the reason so far has not been discerned, I'd much prefer to keep it behind an easy-to-override flag instead. Those that care or want it supported, will be able to enable and test for it. And those that don't, probably won't miss it. |
da948c9
to
5d67981
Compare
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/prs-already-reviewed/2617/1180 |
Since this program showed up on hacker news today I went looking in nixpkgs! Can you explain why the SDK is needed to build? I wasn't really able to understand it. Is that only for 64 bit or non-x86 builds? I don't have any of the other games to test it with at the moment. I would suggest splitting it into a 32-bit and 64-bit package (kinda like wine). I was able to get a 32 bit build running against the latest git:
A couple issues I ran into:
I tested your package on nixos 23.05. I had to change
*EDIT: I think you might also want to add The command I used to build in its own folder outside of nixpkgs: |
Oh, and TIL another way to avoid the zip timestamp problem is to put |
Why did you test against 23.05? |
Yeah that was dumb. Hopefully that means some of my comments are wrong! |
It's been a month since I last checked on this package, since no one has merged it yet. So there might be breakage perhaps, it wouldn't be the first time. I also don't remember everything so well. So make sure to test with unstable to see if you're still having problems building it.
Ah nice. It's not documented in the nixpkgs manual though :p but I will try this. EDIT: where did you find it ? I can't even find it on the internet
For 64bit you need it for sure. For 32bit you don't need it, because then it will just use the one that is bundled with the game you play. For example Half-Life has in its directory dlls/hl.so and cl_dlls/client.so . Those bundled libraries are compiled for 32bit since the original games are for 32bit, that's why for 64bit you can't use them and have to build the SDK. But you can also just build the SDK for 32bit and it works too. Or so I think. I've never tested it since I'm on 64bit.
Honestly I've never really understood the business with VGUI. Also using |
5d67981
to
6c490dc
Compare
Nice, |
Thanks for the help/pointers and also the explanations about how the engine works. I will try to take a look next week.
I think grepping through nixpkgs. I was looking for similar date problems and if other packages had the issue for waf. It still it took me awhile to notice it even though it is even in the waf package, hah! |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/prs-already-reviewed/2617/1342 |
I am no longer using Nix. Someone else will have to take maintainership if this ever gets merged |
I think the lack of momentum on this is due to the license - it's unfree, meaning it won't be cached by Hydra, and people will have to rebuild it every time anyway so there's not really much point, as much as it saddens me. |
My comment about dropping maintainership is not really related with this PR being stale, it's just that I'm not using Nix anymore, for other reasons. |
Description of changes
Xash3D is a GoldSrc reimplementation capable of running Half-Life.
Closes #231696.
Also closes #166081 which was targetting the old Xash3D engine. This pull requests targets the FWGS fork. I just named the package xash3d and not xash3d-fwgs since the old Xash3D is deprecated and never made it into nixpkgs anyway.
My only big issue with this is that it needs to modify the assets of Half-Life to properly run on 64bit. I wrote a wrapper for this that will make the required symlinks from the libraries in hlsdk to the assets. I don't know if there is a better way, but that's what the AUR does (https://aur.archlinux.org/packages/xash3d-git and the old https://aur.archlinux.org/packages/xash3d-fwgs-git).
Things done
sandbox = true
set innix.conf
? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)