-
-
Notifications
You must be signed in to change notification settings - Fork 14.6k
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
emacs: fix default values of withFoo flags after overrideAttrs #365784
base: staging
Are you sure you want to change the base?
Conversation
Previously, the normal way to override src and version led to wrong default values of withFoo flags. Here is an minimal reproducible example for withXwidgets which should default to false when version >= 30. ```console $ nix eval --include nixpkgs=$PWD --impure --expr ' let pkgs = import <nixpkgs> { config = { }; overlays = [ ]; }; in (pkgs.emacs29-pgtk.overrideAttrs { version = "30"; }).withXwidgets ' true ``` This fix keeps backward compatibility for the .override interface. Fixes: nix-community/emacs-overlay#455
withGlibNetworking ? withPgtk || withGTK3 || (withX && withXwidgets), | ||
withGpm ? stdenv.hostPlatform.isLinux, | ||
withImageMagick ? lib.versionOlder version "27" && (withX || withNS), | ||
withNativeCompilation ? throw "dummy value for backward compatibility, should never be evaled", |
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.
Probably we need a better way to handle this.
The indention of keeping this optional flags is to keep backward compatibility for the .override
interface: emacs29-pgtk.override { withXwidgets = false; }
.
assertions = | ||
assert | ||
(finalAttrs.withGTK3 && !finalAttrs.withNS && variant != "macport") | ||
-> finalAttrs.withX || finalAttrs.withPgtk; | ||
assert | ||
finalAttrs.noGui | ||
-> !(finalAttrs.withX || finalAttrs.withGTK3 || finalAttrs.withNS || variant == "macport"); | ||
assert finalAttrs.withAcl -> stdenv.hostPlatform.isLinux; | ||
assert finalAttrs.withAlsaLib -> stdenv.hostPlatform.isLinux; | ||
assert finalAttrs.withGpm -> stdenv.hostPlatform.isLinux; | ||
assert | ||
finalAttrs.withNS -> stdenv.hostPlatform.isDarwin && !(finalAttrs.withX || variant == "macport"); | ||
assert finalAttrs.withPgtk -> finalAttrs.withGTK3 && !finalAttrs.withX; | ||
assert finalAttrs.withXwidgets -> !finalAttrs.noGui && (finalAttrs.withGTK3 || finalAttrs.withPgtk); | ||
true; # dummy value to make syntax right |
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.
This works but maybe we can improve it.
Previously, the normal way to override src and version led to wrong default values of withFoo flags.
Here is an minimal reproducible example for withXwidgets which should default to false when version >= 30.
This fix keeps backward compatibility for the .override interface.
Fixes: nix-community/emacs-overlay#455
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.