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

qtile: install proper session .desktop files for both xorg and wayland #316239

Merged
merged 1 commit into from
Jun 15, 2024

Conversation

arjan-s
Copy link
Contributor

@arjan-s arjan-s commented May 31, 2024

Description of changes

This PR modifies the qtile package to install the provided session desktop files for login managers.
That in turn allows us to add the package to services.displayManager.sessionPackages when the NixOS module is enabled.
After that, both the Xorg and Wayland sessions will be available from login (display) managers, instead of just one session that's hard coded to a specific backend (via the now removed option backend).

Additionally, this fixes the services.xserver.windowManager.qtile.finalPackage assignment to use the qtile package instead of building a whole new env.

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.11 Release Notes (or backporting 23.11 and 24.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.

@Sigmanificient
Copy link
Member

Sigmanificient commented May 31, 2024

When running nix-build -A qtile-unwrapped.passthru.tests.qtile

error: Default graphical session, 'none+qtile', not found.
       Valid names for 'services.displayManager.defaultSession' are:
         qtile
         none+icewm

@Sigmanificient
Copy link
Member

build my whole system with your branch, seems to work:
image

@arjan-s
Copy link
Contributor Author

arjan-s commented Jun 1, 2024

Thanks! This PR changed the session names, that's why the test is failing.
Since these changes work on both our systems, I'll just fix the test.

Another todo I thought of after submitting is marking the now-removed backend option deprecated, so people having that in their configs get a nice message.

@Sigmanificient
Copy link
Member

Another todo I thought of after submitting is marking the now-removed backend option deprecated, so people having that in their configs get a nice message.

Yes this would be nice

@arjan-s arjan-s force-pushed the qtile-sessions branch 2 times, most recently from c529123 to 74fbf52 Compare June 1, 2024 08:33
@arjan-s
Copy link
Contributor Author

arjan-s commented Jun 1, 2024

Both done!

@ofborg ofborg bot requested a review from Sigmanificient June 1, 2024 09:17
@arjan-s
Copy link
Contributor Author

arjan-s commented Jun 3, 2024

Looking at this again, I'm afraid the configFile option should be deprecated too. But that could break the way some people configure their system, especially those who don't use home-manager (which can write ~/.config/qtile/config.py).
We can't easily modify the session files that are now installed by the package, so the 'old' method isn't feasible I think.
I'm hoping others have ideas about this...? Perhaps a good solution would be a link to the provided config in the system-wide config dir (qtile docs here)?

@Sigmanificient
Copy link
Member

Sigmanificient commented Jun 3, 2024

it look after into the .desktop pr, indead would break the configFile option.

Setting to /etc/xdg would work, but for users that used previous configFile options, it may not be the cleanest especially one multiple users system.

I'm a bit new to options, could the desktop file be wrapped in it's own derivation, with something like this?

postPatch = ''
  substituteInPlace resources/qtile.desktop \
    --replace-fail "qtile start" "qtile start --config ${cfg.configFile}"
'';

@arjan-s
Copy link
Contributor Author

arjan-s commented Jun 3, 2024

Actually, my idea was to do something like this:

environment.etc."qtile/config.py".source = lib.optional (cfg.configFile != null) cfg.configFile;

This would create a link in /etc/xdg/qtile/config.py to the user's provided config (in the nix store).

@arjan-s
Copy link
Contributor Author

arjan-s commented Jun 3, 2024

Done. I believe this is ready to test (again).

@ofborg ofborg bot requested a review from Sigmanificient June 3, 2024 19:39
@arjan-s arjan-s marked this pull request as draft June 7, 2024 19:12
@arjan-s
Copy link
Contributor Author

arjan-s commented Jun 7, 2024

Converted to draft, because after testing I found that the logic regarding the wrapper and systemPackages isn't right. I'll have to dive deeper to get to a point where it just works.

@arjan-s
Copy link
Contributor Author

arjan-s commented Jun 7, 2024

Okay, I believe I have now (finally) arrived at a working and much cleaner solution!

  • I removed the wrapper since we weren't actually using it anyway (we built a separate new env for display managers and we added the unwrapped package to environment.systemPackages).
  • The extraPackages are now nicely added to the dependencies of Qtile itself, making qtile: Fix QTile restart environment #299843 a thing of the past (I hope).
  • The finalPackage (which optionally contains qtile-extras and other dependencies) is used for both display managers and added to $PATH (the latter makes commands like qtile check work).
  • If a configFile is provided, it is symlinked to /etc/xdg/qtile/config.py, which is automatically used by Qtile if ~/.config/qtile/config.py isn't found.

@arjan-s arjan-s marked this pull request as ready for review June 7, 2024 20:54
@arjan-s arjan-s requested a review from jwijenbergh June 7, 2024 20:55
Copy link
Contributor

@drupol drupol left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@jwijenbergh jwijenbergh left a comment

Choose a reason for hiding this comment

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

Thanks a lot for making these changes. Looks good to me. Should we maybe move qtile later to programs.qtile? Most wayland compositors do that, but I'm not sure for qtile as it also supports x11

@drupol drupol merged commit 7938d40 into NixOS:master Jun 15, 2024
24 checks passed
@arjan-s arjan-s deleted the qtile-sessions branch June 15, 2024 18:25
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

6 participants