nix-community / home-manager

Manage a user environment using Nix [maintainer=@rycee]
https://nix-community.github.io/home-manager/
MIT License
6.64k stars 1.75k forks source link

Polkit authentication agent(s) #3739

Open cyntheticfox opened 1 year ago

cyntheticfox commented 1 year ago

Description

I'm running into needing/wanting a graphical Polkit agent, but there's no current agents present in home-manager.

I've seen #2400 and am considering writing something based on that, though with the GNOME polkit as I'm running Sway, and other recommendations I've been given involved xdg-autostart (which is external state).

Could we re-open the mentioned PR, or should I draft a new one?

I'm currently just running

systemd.user.services.sway-polkit-authentication-agent = {
  Unit = {
    Description = "Sway Polkit authentication agent";
    Documentation = "https://gitlab.freedesktop.org/polkit/polkit/";
    After = [ "graphical-session-pre.target" ];
    PartOf = [ "graphical-session.target" ];
  };

  Service = {
    ExecStart = "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1";
    Restart = "always";
    BusName = "org.freedesktop.PolicyKit1.Authority";
  };

  Install.WantedBy = [ "graphical-session.target" ];
};

Not sure if that BusName arg is needed...

stale[bot] commented 1 year ago

Thank you for your contribution! I marked this issue as stale due to inactivity. Please be considerate of people watching this issue and receiving notifications before commenting 'I have this issue too'. We welcome additional information that will help resolve this issue. Please read the relevant sections below before commenting.

If you are the original author of the issue

* If this is resolved, please consider closing it so that the maintainers know not to focus on this. * If this might still be an issue, but you are not interested in promoting its resolution, please consider closing it while encouraging others to take over and reopen an issue if they care enough. * If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.

If you are not the original author of the issue

* If you are also experiencing this issue, please add details of your situation to help with the debugging process. * If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.

Memorandum on closing issues

Don't be afraid to manually close an issue, even if it holds valuable information. Closed issues stay in the system for people to search, read, cross-reference, or even reopen – nothing is lost! Closing obsolete issues is an important way to help maintainers focus their time and effort.

zombiehoffa commented 6 months ago

did this go anywhere? I see it still open.

mobsenpai commented 3 months ago

@rycee This should be added.

I am using this currently ->

{
  config,
  lib,
  pkgs,
  ...
}: {
  options = {
    myNixos.polkit-gnome.enable = lib.mkEnableOption "Enables polkit-gnome";
  };

  config = lib.mkIf config.myNixos.polkit-gnome.enable {
    security.polkit.enable = true;

    systemd.user.services.polkit-gnome-authentication-agent-1 = {
      description = "polkit-gnome-authentication-agent-1";
      wantedBy = ["graphical-session.target"];
      wants = ["graphical-session.target"];
      after = ["graphical-session.target"];
      serviceConfig = {
        Type = "simple";
        ExecStart = "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1";
        Restart = "on-failure";
        RestartSec = 1;
        TimeoutStopSec = 10;
      };
    };
  };
}
mobsenpai commented 3 months ago

did this go anywhere? I see it still open.

no sadly.

sumnerevans commented 3 months ago

@mobsenpai feel free to submit a PR with your changes.

mobsenpai commented 2 months ago

@sumnerevans I waited for someone experienced to do it first, because I haven't opened any PR but here you go! I know it's not at all a good PR, but I did what I could.

5619