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

newsflash: fix adding xdg-open to PATH #186982

Merged
merged 1 commit into from
Aug 19, 2022
Merged

Conversation

kira-bruneau
Copy link
Contributor

@kira-bruneau kira-bruneau commented Aug 16, 2022

Description of changes

Fixes opening links in newsflash

Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • 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/)
  • 22.11 Release Notes (or backporting 22.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
    • (Release notes changes) Ran nixos/doc/manual/md-to-db.sh to update generated release notes
  • Fits CONTRIBUTING.md.

@kira-bruneau
Copy link
Contributor Author

Result of nixpkgs-review pr 186982 run on x86_64-linux 1

1 package built:
  • newsflash

@LunNova
Copy link
Member

LunNova commented Aug 16, 2022

Surprised you ran into this, many apps don't add this to the path/wrap it, and instead rely on environment.systemPackages having it from having a desktop environment enabled.

Adding it to the path from the package input like this makes it harder to swap out your implementation of xdg-utils/xdg-open at runtime as this package won't respect the version on the system path.

@kira-bruneau
Copy link
Contributor Author

kira-bruneau commented Aug 16, 2022

Yeah, I think something on my system was indirectly including xdg-open in my PATH before, so I didn't notice the problem before now.

A bunch of other apps in nixpkgs hard-code it too. Why would you need to swap out xdg-open at runtime? I think we should be hard-coding it whenever an application expects it to exist. It's basically just a proxy to whatever you have globally configured, in the same way dbus.lib is hard-coded for applications that use dbus.

@LunNova
Copy link
Member

LunNova commented Aug 16, 2022

You might want to patch xdg-open to use the portal to launch apps without rebuilding everything that depends on it, or you might want to replace it entirely eg with handlr.

@kira-bruneau
Copy link
Contributor Author

Ok thanks! That's a good point, I still feel like we should provide a default when you're not specifying a different implementation though. I noticed #181171 changes --prefix wrapper to --suffix wrappers in a bunch of places, would you be ok with that?

@LunNova
Copy link
Member

LunNova commented Aug 16, 2022

Suffix sounds great! That's a cool PR.

@kira-bruneau
Copy link
Contributor Author

kira-bruneau commented Aug 16, 2022

I almost wonder if we should have someway to describe a package that depends on a something being in $PATH / requires a file to exist, without hardcoding a specific implementation.

Then something like nixos-rebuild should throw an error if you didn't add a package that satisfied the requirements.

@kira-bruneau
Copy link
Contributor Author

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/should-we-support-encoding-runtime-dependencies-without-requiring-a-specific-implementation/21031/6

@bobby285271 bobby285271 added the 12.approvals: 1 This PR was reviewed and approved by one reputable person label Aug 17, 2022
@LunNova
Copy link
Member

LunNova commented Aug 17, 2022

https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/services/x11/xserver.nix#L675 - this is the line adding it to the system path for most users and why nobody noticed this originally

@kira-bruneau
Copy link
Contributor Author

Oh thanks for pointing that out!

@github-actions
Copy link
Contributor

Successfully created backport PR #187396 for release-22.05.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
10.rebuild-darwin: 1-10 10.rebuild-darwin: 1 10.rebuild-linux: 1-10 10.rebuild-linux: 1 11.by: package-maintainer This PR was created by the maintainer of the package it changes 12.approvals: 1 This PR was reviewed and approved by one reputable person
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants