Sway WM configuration: Polkit, login manager

I am trying to configure Polkit on Sway, no success.
Also, I want to get some login manager to work with Sway, GDM and SDDM do not detect sway. Do I have to configure SDDM somehow to make it see Sway?

Hi, for people to help we’d need to see the configuration.nix you’ve tried and what NixOS release you are using.

The version is 19.03

I have tried:

programs.sway.enable = true;
services.xserver.displayManager.sddm.enable = true;
system.stateVersion = "19.03";

Hoped that sddm will detect the session, but it looks like the Nix way is to tell it somehow.

also tried installing polkit and polkit_gnome packages separately and together.

environment.systemPackages = with pkgs; [

I have found in NixOS manual that polkit_gnome should be used to enable Polkit in XFCE, does not work for Sway.

What I am trying to archive with Polkit is to be able to save files which require higher privileges (i.e. configuration.nix), now I see the error /usr/bin/pkexec failed on Sway, works correctly in Gnome. There are walkarounds but it is a little tricky to to run sudo for graphical apps under Wayland. Probably I will have another issues without Polkit.

Have you used security.polkit.enable? That’s what the gnome3 module uses.

Where in the manual did you find this? I think it needs to be updated.
And you probably do need polkit_gnome since it is an authentication agent, but it uses an xdg autostart. I’m not sure if sway handles those.

Any luck with getting polkit running within sway?

I found this in askubuntu & it’s for i3 but works for sway as well.

add this to your sway config:

exec --no-startup-id /usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1 &

Although i use polkit-kde but it should work with polkit-gnome as well

1 Like