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

umu-launcher[-unwrapped]: init at 1.1.4 #369259

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

diniamo
Copy link
Contributor

@diniamo diniamo commented Dec 29, 2024

Closes #297662

This was a tough one, but my version still turned out miles better than what they have in their repo (do not look at it if you care about your eyesight).

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 25.05 Release Notes (or backporting 24.11 and 25.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@diniamo
Copy link
Contributor Author

diniamo commented Dec 29, 2024

Oh yeah, the build fails because of #366359, I've been working on this with doCheck = false in hatch's package definition.

@github-actions github-actions bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10 labels Dec 29, 2024
@diniamo diniamo changed the title umu-launcher: init at 1.1.4 umu-launcher[-unwrapped]: init at 1.1.4 Dec 30, 2024
@diniamo diniamo force-pushed the umu-launcher branch 2 times, most recently from 73f963a to 9257d01 Compare December 30, 2024 01:41
@ofborg ofborg bot added 8.has: package (new) This PR adds a new package 11.by: package-maintainer This PR was created by the maintainer of the package it changes labels Dec 30, 2024
pkgs/by-name/um/umu-launcher-unwrapped/package.nix Outdated Show resolved Hide resolved
pkgs/by-name/um/umu-launcher-unwrapped/package.nix Outdated Show resolved Hide resolved
Comment on lines 3 to 5
# HACK: This has to be umu-run for the executable to be called that, but the
# package attribute is still umu-launcher. Is there a better way?
pname = "umu-run";
Copy link
Contributor

@MattSturgeon MattSturgeon Jan 3, 2025

Choose a reason for hiding this comment

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

Looks like it requires changes to buildFHSEnv

I was looking for the implementation in https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/build-fhsenv-bubblewrap/buildFHSEnv.nix, but I believe it's actually this line in default.nix:

executableName = args.pname or args.name;

Making executableName a de-structured function arg should solve this limitation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not in the scope of those PR. Changing basic builders probably also has a convoluted process so I don't think I will bother.

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed it's not really in scope for this PR. Was just raising the discussion as it was something you'd highlighted with your comments.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

executableName is now merged

@beh-10257
Copy link

do not look at it if you care about your eyesight

instead of saying this type of stuff why don't you tell me what are your complaints and actually make an improvement

@diniamo
Copy link
Contributor Author

diniamo commented Jan 7, 2025

Sorry. The improvement is this package, since I saw more value in upstreaming a proper package to nixpkgs compared to fixing the problems in the flake.

@diniamo
Copy link
Contributor Author

diniamo commented Jan 7, 2025

On another note, @MattSturgeon please mark the threads as resolved if they are.

Also, should I add you and @beh-10257 as maintainers to the package (assuming you're already in the maintainers list)?

@beh-10257
Copy link

the flake is always gonna be more up to date so there is value in that
yes add me to the maintainers list
can you list the improvements so I can make the flake better like I'm trying to make things better here so cooporate

@MattSturgeon
Copy link
Contributor

On another note, @MattSturgeon please mark the threads as resolved if they are.

I don't have permission to do that. I think as PR author you can? Otherwise someone with write-access must do it.

@diniamo
Copy link
Contributor Author

diniamo commented Jan 7, 2025

Huh? You should be able to resolve your own reviews. Well in that case, do you want to add anything else or can I resolve them?

@diniamo
Copy link
Contributor Author

diniamo commented Jan 7, 2025

...can you list the improvements so I can make the flake better...

@beh-10257 most of them you can get by replacing the package definitions entirely with the ones from this PR, while adapting them for the flake (make sure to tell me about anything that's missing from the packages in this PR along with a good reasoning as well, so I can add them too; eg. optional dependencies, since I couldn't find anything about those, but I did see some in the Nix package). Once you do that, I'll PR the rest of my suggestions, since that's easier than explaining.

@MattSturgeon
Copy link
Contributor

MattSturgeon commented Jan 7, 2025

Huh? You should be able to resolve your own reviews.

From Resolving conversations:

You can resolve a conversation in a pull request if you opened the pull request or if you have write access to the repository where the pull request was opened.

Well in that case, do you want to add anything else or can I resolve them?

Most of my threads were more discussion than feedback. If you feel that they are resolved, then feel free to mark as such.


the flake is always gonna be more up to date so there is value in that
can you list the improvements so I can make the flake better like I'm trying to make things better here so cooporate

I agree it'd be nice if the flake and nixpkgs were kept in sync. This will likely need breaking changes though.

One way that could be done would be to have the flake base itself on the nixpkgs impl, simply overriding src to point to the upstream repo. E.g:

# flake outputs
{
  overlays.default = final: prev: {
    umu-launcher-unwrapped = prev.umu-launcher-unwrapped.overrideAttrs (old: {
      # TODO: would be nice to filter out irrelevant dirs,
      # to avoid them invalidating build caches
      # e.g. using filesets
      src = ../../.;

      # TODO: version should also be something sensible
      version = "?";
    });
  };
}

One way to avoid that being an invisibly breaking change, would be to add a new flake.nix to the root of the upstream repo.

By keeping the old flake at its existing location (with a warning), users would have time to migrate to the new flake at the new location.

That way a) end-users don't need ?dir=packaging/nix and b) the old flake can be left as-is for a period of migration.

@diniamo
Copy link
Contributor Author

diniamo commented Jan 7, 2025

Not needing ?dir=packaging/nix would be the breaking change, as it's been there previously. Also yeah, an override-based approach would be nice.

@MattSturgeon
Copy link
Contributor

MattSturgeon commented Jan 7, 2025

Also, should I add you and @ beh-10257 as maintainers

Sorry I missed that question. Feel free to add me 👍

@LovingMelody
Copy link
Contributor

Please add me to the maintainers list as well (fuzen)

@diniamo
Copy link
Contributor Author

diniamo commented Jan 11, 2025

Added the 2 of you, but I couldn't find @beh-10257

@@ -0,0 +1,15 @@
{ buildFHSEnv, umu-launcher-unwrapped }:
Copy link
Contributor

Choose a reason for hiding this comment

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

May be worth copying heroic

extraPkgs ? pkgs: [ ],
extraLibraries ? pkgs: [ ],

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why?

Copy link
Contributor

Choose a reason for hiding this comment

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

To make it easier for end-users to add extra packages to the FHS environment by overriding.

This could be done in a follow-up PR if preferred

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes I what the code does, but in what scenario would that be useful

I assume heroic launcher also supports native games, in which case it would make sense, but as far as I know, umu is for windows games only

Copy link
Contributor

Choose a reason for hiding this comment

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

Needed for passing graphics and fixing a cursor issue. Graphics is needed for dxvk-nvapi to work

extraLibraries = pkgs: let
prevLibs = if prev ? extraLibraries then prev.extraLibraries pkgs else [ ];
additionalLibs = with config.hardware.graphics;
if pkgs.stdenv.hostPlatform.is64bit
then [ package ] ++ extraPackages
else [ package32 ] ++ extraPackages32;
in prevLibs ++ additionalLibs;

@diniamo
Copy link
Contributor Author

diniamo commented Jan 17, 2025

Fixed formatting

Copy link
Contributor

@MattSturgeon MattSturgeon left a comment

Choose a reason for hiding this comment

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

Oh yeah, the build fails because of #366359, I've been working on this with doCheck = false in hatch's package definition.

The fix (#371743) is currently in staging-next. Not sure how long until that'll be merged into master.

Comment on lines +9 to +10
- sed 's|##UMU_VERSION##|$(shell git describe --always --long --tags)|g' -i $(<).tmp
+ sed 's|##UMU_VERSION##|@version@|g' -i $(<).tmp
Copy link
Contributor

Choose a reason for hiding this comment

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

This patch shouldn't be needed once Open-Wine-Components/umu-launcher#289 makes it into a release.

Maybe gate the patch file behind lib.versionOlder "1.1.5" or `version == "1.1.4"? Assuming this PR gets merged before there's another upstream release.

That way anyone overriding this package with a newer version (or commit) won't also need to disable the patch.

Comment on lines +18 to +19
-RELEASEDIR := $(PROJECT)-$(shell git describe --abbrev=0)
+RELEASEDIR := $(PROJECT)-@version@
Copy link
Contributor

Choose a reason for hiding this comment

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

This patch could be avoided by overriding RELEASEDIR explicitly in makeFlags.

If it matters, we know $(PROJECT) should always be umu-launcher. But I think for our purposes RELEASEDIR could be any string?

};

patches = [
./makefile-installer-prefix.patch
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you add a comment to explain why this patch is needed? And/or a TODO/FIXME if you think there's a better approach?

(personally, I don't really understand why we need --prefix instead of --destdir here)

pyproject = false;
configureScript = "./configure.sh";

# The Makefile variables are a big mess, but this combination (and the patches) more or less do what we want
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: could we avoid vague negativity in comments? It could be helpful to list issues we have with the upstream variables, but I think this comment as-is may be counter-productive.

Comment on lines +42 to +50
preBuild = ''
makeFlagsArray+=(
"PYTHON_INTERPRETER=${lib.getExe python3Packages.python}"
"SHELL_INTERPRETER=${lib.getExe bash}"
"PREFIX="
"PYTHONDIR=/${python3Packages.python.sitePackages}"
"DESTDIR=$out"
)
'';
Copy link
Contributor

Choose a reason for hiding this comment

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

I know we touched on this before, but my preference would be to set this via makeFlags instead of having a preBuild script.

I think this would make the package easier to override. Probably not a big deal, but it feels cleaner.

This could be done by either

  • setting DESTDIR to some local path, then later during the installPhase moving the files to $out,
  • or by setting DESTDIR=${placeholder "out"}.

targetPkgs = pkgs: [ pkgs.umu-launcher-unwrapped ];

executableName = "umu-run";
runScript = "${umu-launcher-unwrapped}/bin/umu-run";
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
runScript = "${umu-launcher-unwrapped}/bin/umu-run";
runScript = lib.getExe umu-launcher-unwrapped;


targetPkgs = pkgs: [ pkgs.umu-launcher-unwrapped ];

executableName = "umu-run";
Copy link
Contributor

Choose a reason for hiding this comment

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

IDK if this is good practice, but this could be set as:

Suggested change
executableName = "umu-run";
executableName = umu-launcher-unwrapped.meta.mainProgram;

@MattSturgeon
Copy link
Contributor

Also, should I add you and @beh-10257 as maintainers to the package (assuming you're already in the maintainers list)?

yes add me to the maintainers list

Added the 2 of you, but I couldn't find @beh-10257

It seems they aren't in the list. It'd be great to have them, but that'll have to do that themselves in a follow up PR.

@beh-10257 see the relevant documentation:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
8.has: package (new) This PR adds a new package 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10 11.by: package-maintainer This PR was created by the maintainer of the package it changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Package request: umu-launcher
4 participants