Skip to content
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

build(nix): minor fixes #384

Merged

Conversation

MattSturgeon
Copy link
Contributor

@MattSturgeon MattSturgeon commented Feb 15, 2025

Based on @R1kaB3rN's feedback in NixOS/nixpkgs#381975

Pushed up separately to #374, so that we can keep that one small & atomic.

  • Use configure flags to disable building vendored dependencies
  • Ensure pystd is always installed - it isn't optional
  • Switch from propagatedBuildInputs to pythonPath
  • Move cargo lock to before dependencies
  • Added check phase

cc @beh-10257 @LovingMelody @R1kaB3rN

- Use configure flags to disable building vendored dependencies
- Ensure pystd is always installed - it isn't optional
- Move cargo lock to before dependencies
preCheck = ''
${prev.preCheck or ""}

# Some tests require a writable HOME
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll have to rethink and improve the tests later because we shouldn't have to write to $HOME. It may require making the relevant functions more testable by accepting $XDG_DATA_HOME as a new parameter instead of calling Path.home(), which should be easy to do.

Copy link
Member

@R1kaB3rN R1kaB3rN Feb 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In addition to not writing to $HOME, the unit tests needs to be refactored to creating temporary directories in the system's tmpfs whenever possible.

Both of those changes will be large and done at a later time in a separate pull request. Until that's merged, I'm not really comfortable with suggesting to run the unit tests in nixpkgs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, unit tests writing to (or reading from) HOME is not ideal. It's inherently impure and will result in tests that are not pure or idempotent.

However since nix runs the tests in a sandbox and we have to use a temp HOME if we want it to be writable anyway, this isn't a blocker from nixpkgs perspective.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

writableTmpDirAsHomeHook was merged into nixpkgs a couple weeks ago, so I'll use that in the downstream package. Could use it here too, but it requires bumping the lockfile.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. Let’s use writableTmpDirAsHomeHook then merge this PR afterward

];

disabledTests = [
# Broken? Asserts that $STEAM_RUNTIME_LIBRARY_PATH is non-empty
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's empty then it implies ldconfig does not exist or it does, but could not find the shared library paths of the system. This varies by distribution, and in Arch Linux it's /usr/lib and /usr/lib/libfakeroot at the very least. In addition to those, umu-launcher includes the game directory, but the expectation is for there to be at least 2 paths.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For NixOS I can imagine it can vary across systems. For home manager, which I use, the path is:

STEAM_RUNTIME_LIBRARY_PATH=/usr/lib64:/usr/lib32:/nix/store/m2mwcap0d7ylsap005vpr6xan063jlax-glibc-2.40-66/lib

This was run with the command PROTONPATH=GE-Proton GAMEID=umu-0 umu-run ""

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the test is OK to be skipped here, and I'm sorta thinking an e2e test may be more appropriate instead of a unit test here...

Copy link
Contributor Author

@MattSturgeon MattSturgeon Feb 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect the issue here is that we run the tests within the same sandbox environment that's used to build the package.

Therefore impure environment variables, including things related to Steam, are not set.

This is an intentional design decision intended to keep nix packages "pure" and deterministic.

Is the test assuming it is running on a fully installed system?

# Broken? Asserts that $STEAM_RUNTIME_LIBRARY_PATH is non-empty
# Fails with AssertionError: '' is not true : Expected two elements in STEAM_RUNTIME_LIBRARY_PATHS
"test_game_drive_empty"
"test_game_drive_libpath_empty"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These tests failing are related to the above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants