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

nixos/xserver: don't conflict pinentry package with DEs #296866

Merged
merged 1 commit into from Mar 20, 2024

Conversation

SuperSandro2000
Copy link
Member

@SuperSandro2000 SuperSandro2000 commented Mar 18, 2024

Description of changes

When both plasma6 and xserver are enabled, programs.gnupg.agent.pinentryPackage is not set to the qt variant. When only xserver is enabled it is the gnome3 variant, without requiring any extra things.

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/)
  • 24.05 Release Notes (or backporting 23.05 and 23.11 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.

@NovaViper
Copy link

NovaViper commented Mar 18, 2024

Hey I just tested this in my flake, so far I haven't ran into the inital pinentry conflict but another issue has arisen related to gnome.nix:

> Building NixOS configuration
warning: updating lock file '/home/novaviper/Documents/NixConfig/flake.lock':
• Added input 'nixpkgs-xserver':
    'github:SuperSandro2000/nixpkgs/124ec2d9d65e19297a3f1fbd298288a022e2267a' (2024-03-18)
error:
       … while calling the 'seq' builtin

         at /nix/store/7ay2dd0w41iqvrnkx19v4vf4f5kkxvc2-source/lib/modules.nix:322:18:

          321|         options = checked options;
          322|         config = checked (removeAttrs config [ "_module" ]);
             |                  ^
          323|         _module = checked (config._module);

       … while evaluating a branch condition

         at /nix/store/7ay2dd0w41iqvrnkx19v4vf4f5kkxvc2-source/lib/modules.nix:261:9:

          260|       checkUnmatched =
          261|         if config._module.check && config._module.freeformType == null && merged.unmatchedDefns != [] then
             |         ^
          262|           let

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: The option `services.xserver.desktopManager.gnome3.flashback' in `/nix/store/7ay2dd0w41iqvrnkx19v4vf4f5kkxvc2-source/nixos/modules/services/x11/desktop-managers/gnome.nix' is already declared in `/nix/store/jxbmm0y31wia2h5m40magrdyalga7ydi-source/nixos/modules/services/x11/desktop-managers/gnome.nix'.

Flake nixpkg info:

❯ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.8.1, NixOS, 24.05 (Uakari), 24.05.20240316.c75037b`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.2`
 - nixpkgs: `/nix/store/7ay2dd0w41iqvrnkx19v4vf4f5kkxvc2-source`

Edit:
Ah I just realized I'm on the nixos-unstable branch and not on nixos-unstable-small like I was before, switching and will test again Still broken even on nixos-unstable-small, same error as stated above

@SuperSandro2000
Copy link
Member Author

This is unrelated to this change and very likely caused on that you load nixos/modules/services/x11/desktop-managers/gnome.nix twice.

@NovaViper
Copy link

NovaViper commented Mar 19, 2024

Ah how do I make sure that gnome.nix isn't loaded twice?

Edit: Even disabling that didn't fix it, now i'm getting the same kind of error but for /nixos/modules/services/x11/desktop-managers/plasma5.nix and even /nixos/modules/services/x11/desktop-managers/default.nix

@zendo
Copy link
Contributor

zendo commented Mar 20, 2024

Tested, works for me.

@SuperSandro2000
Copy link
Member Author

@NovaViper you're issue is really unrelated to the issue this PR fixes and lies somewhere in your config mixing different channels not properly.

@SuperSandro2000 SuperSandro2000 merged commit 50b2e2a into NixOS:master Mar 20, 2024
29 checks passed
@SuperSandro2000 SuperSandro2000 deleted the xserver-pinentry branch March 20, 2024 13:32
@NovaViper
Copy link

NovaViper commented Mar 20, 2024

@SuperSandro2000 Ah I realize now, I was suppose to put the nixpkgs input as this PR instead of as a separate input. Sorry for the confusion 😓

@dartheian
Copy link

Hi, the same is still happening with xfce:

error: The option `programs.gnupg.agent.pinentryPackage' is defined multiple times while it's expected to be unique.
Definition values:
- In `/nix/store/zaza7mgggz4m5h6z18kajabf4wciaj47-source/nixos/modules/services/x11/desktop-managers/xfce.nix': <derivation pinentry-gtk2-1.2.1>
- In `/nix/store/zaza7mgggz4m5h6z18kajabf4wciaj47-source/nixos/modules/services/x11/xserver.nix': <derivation pinentry-gnome3-1.2.1>
Use `lib.mkForce value` or `lib.mkDefault value` to change the priority on any of these definitions.

Will this PR fix the problem?

@SuperSandro2000
Copy link
Member Author

I think it should fix this, it is just not in nixos-unstable, yet. https://nixpk.gs/pr-tracker.html?pr=296866

@sdht0
Copy link
Contributor

sdht0 commented Mar 21, 2024

Shouldn't the package from the individual desktop managers have higher priority instead? For instance, the qt version should be preferred on plasma, no? With this change, the user would need to be aware to override it themselves if using x11?

@SuperSandro2000
Copy link
Member Author

Lower numbers mean higher priority. eg. mkForce has 50 and the default is 1000 if I read it correctly. See

nixpkgs/lib/modules.nix

Lines 1019 to 1024 in 26e8697

mkOptionDefault = mkOverride 1500; # priority of option defaults
mkDefault = mkOverride 1000; # used in config sections of non-user modules to set a default
defaultOverridePriority = 100;
mkImageMediaOverride = mkOverride 60; # image media profiles can be derived by inclusion into host config, hence needing to override host config, but do allow user to mkForce
mkForce = mkOverride 50;
mkVMOverride = mkOverride 10; # used by ‘nixos-rebuild build-vm’

@raboof
Copy link
Member

raboof commented Mar 22, 2024

with this change cherry-picked, it looks like enabling multiple windowmanagers still fails:

       error: The option `programs.gnupg.agent.pinentryPackage' is defined multiple times while it's expected to be unique.

       Definition values:
       - In `/nix/store/952zhqw205fhidfm2v4wdq7b9ym1m6iw-source/nixos/modules/services/x11/desktop-managers/xfce.nix': <derivation pinentry-gtk2-1.2.1>
       - In `/nix/store/952zhqw205fhidfm2v4wdq7b9ym1m6iw-source/nixos/modules/programs/wayland/sway.nix': <derivation pinentry-gnome3-1.2.1>
       Use `lib.mkForce value` or `lib.mkDefault value` to change the priority on any of these definitions.

@SuperSandro2000
Copy link
Member Author

This was also the case before we started the reactor and there is no clear way to solve this.

@raboof
Copy link
Member

raboof commented Mar 22, 2024

This was also the case before we started the reactor

Gotcha: this started failing for me again since 8bf5cc2/#295891 (last week), but indeed going further back I used to have to specify pinentryFlavor, so I guess that is equivalent.

there is no clear way to solve this.

If it's indeed the case the pinentry program must be configured globally and cannot be configured per-session, then indeed I suppose the old behavior was 'wrong' and forcing the user to make an explicit choice here is better.

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

Successfully merging this pull request may close these issues.

None yet

8 participants