-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
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
nexusmods-app: refactor the unfree variant #331355
Conversation
@@ -108,7 +112,6 @@ buildDotnetModule rec { | |||
}; |
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.
How should the tests reference the package's exe without explicitly referencing pkgs.nexusmods-app
?
Presumably this may use the wrong derivation when we're building an overridden package?
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.
Seems most other packages just set nativeBuildInputs = [ nexusmods-app ]
in the test derivations.
Maybe the -unfree
override in all-packages.nix should also be overriding the nexusmods-app
argument passed in?
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'm going to look at these examples using the finalAttrs
pattern tomorrow if I get chance
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.
Sorry, I responded to the other thread pretty much saying what you said here.
90a4960
to
8b35bbb
Compare
Sorry for the conflict, but it's trivial and you should be able to rebase now to drop the change you cherry-picked. |
bbe7f8f
to
05ee324
Compare
What's the rationale for this? It feels like it leaks a bunch of details about what makes the package free vs. unfree into |
My thought process was that it's not really the I haven't looked too hard, but I assume My assumption was that it'd be better to remove the abstraction, exposing the details to end-users who wanted to override the package themselves. I'm happy to add it back, since it is probably a simpler interface for end-users. Although saying that, While I've been using the nix language and module systems for a bit, this is my first time packaging something, so I appreciate all the feedback and guidance I can get! If we add the e.g. |
What if we did:
and add I don't really have a strong opinion about this. There are various examples that support any of these methods:
A couple of other minor things:
|
I considered adding a Is it better to use
Thanks, I didn't spot that!
Yes, I think so. I don't think either me or @l0b0 spotted that package when initially adding nexusmods-app. Should |
Looking at https://github.com/nixos/nixpkgs/blob/master/pkgs/top-level/all-packages.nix#L1466-L1467 |
I think probably not. It only really exists as a variant because there's no free way to support rar. In the event that that changes, we'd probably just deprecate -unfree.
One minor argument against
I think this could also be fine.
I would have actually thought the former, because of how splicing works in There's so much variety in all-packages that realistically any of these options are probably okay. |
05ee324
to
e4f0cf7
Compare
@corngood thanks for your prompt reviews and helpful feedback! |
I noticed the tests are waiting to run on darwin, however this package shouldn't be available on darwin since upstream don't (yet) support it. The package does define Is that a packaging issue on my end, or do the tests always queue for all systems? |
I'm not 100% sure, but my guess is it's not fully checking metadata before queueing and will just end up doing nothing. |
libX11, | ||
nexusmods-app, | ||
runCommand, | ||
pname ? "nexusmods-app", |
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 would I want to optionally change the package name to an arbitrary string, when in reality there's only two useful package names? I'm pretty sure the original pattern of using enableUnfree
(or something like it) is how it's done elsewhere. Having to override _7zz
is much more technically difficult than setting enableUnfree = true
. And finally, enableUnfree
means we can easily add more optional unfree components if necessary without changing the function signature.
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.
Regarding pname
as a package argument: that was discussed in a few comments above, mostly from here onwards: #331355 (comment)
Regarding the motivation for dropping enableUnfree
, see this comment: #331355 (comment)
Having to override _7zz is much more technically difficult than setting enableUnfree = true.
I don't agree that _7zz = pkgs._7zz-rar
is significantly more difficult than enableUnfree = true
.
I also prefer how the former is intrinsically clear about its purpose.
At first glance, the later could be interpreted as any number of unfree things being enabled.
And finally, enableUnfree means we can easily add more optional unfree components if necessary without changing the function signature.
Maybe I'll eat my words, but I don't see that as a likely scenario. Nexusmods-app is committed to being an open source project with open source dependencies.
It is just unfortunate that one optional feature of one dependency currently requires an unfree license.
If there were multiple unfree features to be enabled, then an enableUnfree
argument would be more useful, I agree. If that happens we can revisit this 😀
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 also prefer how the former is intrinsically clear about its purpose.
I prefer how the latter is more clear about the thing I care about. But of course people care about different things. 😁
I still prefer the original design, but I'll let other reviewers decide.
- Format using nixfmt - Apply other minor formatting tweaks - Simplify `--filter` test flag definition
We still need to fix the tests to use `finalAttrs`, but that requires changes to `buildDotnetModule`.
Use `override` to pass a `_7zz` with RAR support to the package, instead of having an `enableUnfree` package argument. Use a different `pname` on the unfree package. Use `_7zz.meta.unfree` internally.
e4f0cf7
to
79d0527
Compare
|
||
You can also enable unrar support manually, by overriding the `_7zz` used: | ||
|
||
```nix | ||
pkgs.nexusmods-app.override { | ||
_7zz = pkgs._7zz-rar; | ||
} | ||
``` |
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 also enable unrar support manually, by overriding the `_7zz` used: | |
```nix | |
pkgs.nexusmods-app.override { | |
_7zz = pkgs._7zz-rar; | |
} | |
``` |
What's the point off this?
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.
More documentation is usually better, right? It sheds some light on what the "unfree" version is actually doing and empowers users to customize the package to their liking.
If you still think this is too verbose for the longDescription
, at least we still have the paragraph above regarding nexusmods-app-unfree
.
executables = [ | ||
nexusmods-app.meta.mainProgram | ||
]; | ||
executables = [ meta.mainProgram ]; |
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.
executables = [ meta.mainProgram ]; | |
executables = [ "NexusMods.App" ]; |
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.
Thanks for the feedback, but could you clarify the motivation?
When I discussed this earlier (#331355 (comment)) it was thought that using meta.mainProgram
via rec
or finalAttrs
would be fine.
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 asked for the same thing in #331150 (comment), but never explained your reasoning.
"--prefix PATH : ${lib.makeBinPath [desktop-file-utils]}" | ||
"--set APPIMAGE $out/bin/${meta.mainProgram}" # Make associating with nxm links work on Linux | ||
"--prefix PATH : ${lib.makeBinPath [ desktop-file-utils ]}" | ||
"--set APPIMAGE ${placeholder "out"}/bin/${meta.mainProgram}" # Make associating with nxm links work on Linux |
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.
"--set APPIMAGE ${placeholder "out"}/bin/${meta.mainProgram}" # Make associating with nxm links work on Linux | |
"--set APPIMAGE ${placeholder "out"}/bin/NexusMods.App" # Make associating with nxm links work on Linux |
Maybe we can use EDIT: Nevermind, to quote the docs:
|
I'm conscious that the nexus team plan to have another release out in a week or so, it'd be nice to get cleanup and refactoring out of the way so that we can refocus on getting the package updated and working. Other than taking advantage of Should I adapt this PR to use |
You've posted reasonable responses to all the comments and there have been no responses, so I'm happy to merge this when you think it's ready.
Your call. I don't mind if it's done separately. |
Add a long description that documents whether or not RAR archive mods are supported and how to enable support.
6190a7d
to
07db828
Compare
I've applied the changes from #331355 (comment), but otherwise I think the feedback is either personal preferences, or best addressed while fixing the recursive definitions to use I think that's best done in a fresh PR, so if you're happy, I'm happy. Let's get this merged! |
Result of 2 packages built:
|
Description of changes
Cherry picked some fixes by @corngood.If dotnet: use unpacked packages in store #327651 is merged before this, they can be dropped in a rebase.
enableUnfree
argument; instead users should override the_7zz
argument.override
instead ofcallPackage
pname
usingoverrideAttrs
_7zz.meta.unfree
Merging this early should hopefully make #331150 easier to work on and review.
See also: #327651 #331150
Closes #321405
cc @l0b0 @corngood @GGG-KILLER @erri120
Things done
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Add a 👍 reaction to pull requests you find important.