Talk:Sway: Difference between revisions

From NixOS Wiki
Latest comment: 3 May by RafTeog in topic Change of Wiki
imported>Dkrejsa
No edit summary
 
(6 intermediate revisions by 4 users not shown)
Line 1: Line 1:
== xdg.portal.gtkUsePortal is deprecated ==
== Calls to dbus-update-activation-environment ==


The method introduced here results in some warnings and errors.
Note that the default sway configuration template <code>/etc/sway/config</code> includes <code>/etc/sway/config.d/*</code>,
and specifically includes <code>/etc/sway/config.d/nixos.conf</code>, which has the following contents:


trace: warning: The option `xdg.portal.gtkUsePortal' defined in `/etc/nixos/configuration.nix' has been deprecated. Setting the variable globally with `environment.sessionVariables' NixOS option can have unforseen side-effects.
    # Import the most important environment variables into the D-Bus and systemd
    # user environments (e.g. required for screen sharing and Pinentry prompts):
    exec dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP
 
Likewise, the example configuration in the wiki creates a script <code>/bin/dbus-sway-environment</code> that attempts
to call <code>dbus-update-activation-environment</code>. (In spite of the partial redundancy with
<code>/etc/sway/config.d/nixos.conf</code>, the dbus-sway-environment script still seems to be necessary to get the
required user dbus services successfully started.) However, neither of these attempts to execute
    dbus-update-activation-environment
works unless dbus-update-activation-environment is in the
path (e.g., unless there is a symlink <code>/run/current-system/sw/bin/dbus-update-activation-environment</code>
pointing at the executable somewhere under <code>/nix/store/</code>). To get dbus-update-activation-environment
and the other binaries from the dbus package into the general path, one should add <code>pkgs.dbus</code>
to the environment.systemPackages list in configuration.nix. (If using home manager, this
might be accomplished by other means.)


error: collision between `/nix/store/k12lcwkw2mlrv962ygqq9gwk4qml33sg-xdg-desktop-portal-gtk-1.14.0/share/applications/xdg-desktop-portal-gtk.desktop' and `/nix/store/kxzpf9mxqp5n665cyd416i31qjk8hn9n-xdg-desktop-portal-gtk-1.14.0/share/applications/xdg-desktop-portal-gtk.desktop'
== Change of Wiki ==


error: builder for '/nix/store/8c2zlvjb0rq6gkkgsbrhq8wkwbyvlnfm-xdg-portals.drv' failed with exit code 255
Scenario:


error: 1 dependencies of derivation '/nix/store/0ni4810ibw9g6m80rrv0d72nc9z17wwn-etc-environment.drv' failed to build
On real hardware, I installed nixos with calamares but no desktop environment selected. Then, I proceeded with flakes and home manager proper configuration. Then I tried to follow the sway guide for home manager. It was then that I ran into this issue <https://discourse.nixos.org/t/wlr-errors-when-trying-to-start-sway/28698>. The solution of that thread worked for me.


error: 1 dependencies of derivation '/nix/store/prvzykrk7brf2pm1b0928ldgymp6ya6b-set-environment.drv' failed to build
So, I propose that <hardware.opengl.enable = true>  to be added in the sway with home manager session,


error: 1 dependencies of derivation '/nix/store/9xxfd2wgvg7r46xy3rdp4mn5azp732n9-system-path.drv' failed to build


== calls to dbus-update-activation-environment ==
To set up Sway using [[Home Manager]], first you must enable [[Polkit]] in your nix configuration:


Note that the default sway configuration template /etc/sway/config includes /etc/sway/config.d/*,
security.polkit.enable = true;
and specifically includes /etc/sway/config.d/nixos.conf , which has the following contents:


    # Import the most important environment variables into the D-Bus and systemd
Additionally, you must enable opengl in your nix configuration //<<<<NEW LINE 1>>>>
    # user environments (e.g. required for screen sharing and Pinentry prompts):
 
    exec dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP
hardware.opengl.enable = true; //<<<<NEW LINE 2>>>>
 
 
A general suggestion of 2 new lines can be seen above.
 
I just registered and I am new to nixos. I don't know the rules about editing the page, so I decided to post it as discussion first.
 
 
Thank you! [[User:RafTeog|RafTeog]] ([[User talk:RafTeog|talk]]) 19:31, 2 May 2024 (UTC)


Likewise, the example configuration in the wiki creates a script /bin/dbus-sway-environment that attempts
:Hello RafTeog,
to call dbus-update-activation-environment.  (Note, the dbus-sway-environment script might not
:you can just start to edit the main page here. Its sometimes difficult to see whether a fix is just needed because you have some special circumstances. I am not a Sway user - maybe there are some circumstances where you dont need OpenGL, because you have an xserver enabled?
be necessary given the inclusion of /etc/sway/config.d/nixos.conf.)
:It may be a good way to just add a „Troubleshooting“ chapter and add your information about opengl and a link to the discource-discussion as a subsection. And: The troubleshooting chapter is already in this article. Maybe a subchapter like „Errors when trying to start sway?“.
However, neither of these attempts to execute
:Just start to contribute - have fun while doing it. Lets make this wiki ready for the 24.5 release together. [[User:Klinger|Klinger]] ([[User talk:Klinger|talk]]) 21:04, 2 May 2024 (UTC)
    dbus-update-activation-environment
::Greetings,
works unless dbus-update-activation-environment is in the
::I will do that, and follow all the advices provided.
path (e.g., unless there is a symlink /run/current-system/sw/bin/dbus-update-activation-environment
::Thank you very much, glad to be here!  [[User:RafTeog|RafTeog]] ([[User talk:RafTeog|talk]]) 00:47, 3 May 2024 (UTC)
pointing at the executable somewhere under /nix/store/).  To get dbus-update-activation-environment
and the other binaries from the dbus package into the general path, one should add pkgs.dbus
to the environment.systemPackages list in configuration.nix.  (If using home manager, this
might be accomplished by other means.)

Latest revision as of 00:47, 3 May 2024

Calls to dbus-update-activation-environment

Note that the default sway configuration template /etc/sway/config includes /etc/sway/config.d/*, and specifically includes /etc/sway/config.d/nixos.conf, which has the following contents:

   # Import the most important environment variables into the D-Bus and systemd
   # user environments (e.g. required for screen sharing and Pinentry prompts):
   exec dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP

Likewise, the example configuration in the wiki creates a script /bin/dbus-sway-environment that attempts to call dbus-update-activation-environment. (In spite of the partial redundancy with /etc/sway/config.d/nixos.conf, the dbus-sway-environment script still seems to be necessary to get the required user dbus services successfully started.) However, neither of these attempts to execute

   dbus-update-activation-environment

works unless dbus-update-activation-environment is in the path (e.g., unless there is a symlink /run/current-system/sw/bin/dbus-update-activation-environment pointing at the executable somewhere under /nix/store/). To get dbus-update-activation-environment and the other binaries from the dbus package into the general path, one should add pkgs.dbus to the environment.systemPackages list in configuration.nix. (If using home manager, this might be accomplished by other means.)

Change of Wiki

Scenario:

On real hardware, I installed nixos with calamares but no desktop environment selected. Then, I proceeded with flakes and home manager proper configuration. Then I tried to follow the sway guide for home manager. It was then that I ran into this issue <https://discourse.nixos.org/t/wlr-errors-when-trying-to-start-sway/28698>. The solution of that thread worked for me.

So, I propose that <hardware.opengl.enable = true> to be added in the sway with home manager session,


To set up Sway using Home Manager, first you must enable Polkit in your nix configuration:

security.polkit.enable = true;

Additionally, you must enable opengl in your nix configuration //<<<<NEW LINE 1>>>>

hardware.opengl.enable = true; //<<<<NEW LINE 2>>>>


A general suggestion of 2 new lines can be seen above.

I just registered and I am new to nixos. I don't know the rules about editing the page, so I decided to post it as discussion first.


Thank you! RafTeog (talk) 19:31, 2 May 2024 (UTC)Reply[reply]

Hello RafTeog,
you can just start to edit the main page here. Its sometimes difficult to see whether a fix is just needed because you have some special circumstances. I am not a Sway user - maybe there are some circumstances where you dont need OpenGL, because you have an xserver enabled?
It may be a good way to just add a „Troubleshooting“ chapter and add your information about opengl and a link to the discource-discussion as a subsection. And: The troubleshooting chapter is already in this article. Maybe a subchapter like „Errors when trying to start sway?“.
Just start to contribute - have fun while doing it. Lets make this wiki ready for the 24.5 release together. Klinger (talk) 21:04, 2 May 2024 (UTC)Reply[reply]
Greetings,
I will do that, and follow all the advices provided.
Thank you very much, glad to be here! RafTeog (talk) 00:47, 3 May 2024 (UTC)Reply[reply]