From 2360497a9a8faa0ef17b3f4fdf15491f204610bf Mon Sep 17 00:00:00 2001 From: Nathan McCarty Date: Sun, 30 Apr 2023 23:36:49 -0400 Subject: [PATCH] Setup polkit --- home-manager/linux/programs/sway.nix | 16 ++++++++++++++++ modules/linux/user.nix | 12 ++++++++++++ 2 files changed, 28 insertions(+) diff --git a/home-manager/linux/programs/sway.nix b/home-manager/linux/programs/sway.nix index a28c3e3..6cf8108 100644 --- a/home-manager/linux/programs/sway.nix +++ b/home-manager/linux/programs/sway.nix @@ -52,6 +52,8 @@ in with lib; { inputs.nixpkgs-unstable.legacyPackages.${pkgs.system}.wob # For fancy x11 scaling inputs.self.packages.${pkgs.system}.sommelier + # Polkit + polkit_gnome ]; ######################### ## Sway @@ -278,6 +280,20 @@ in with lib; { ${layman-package}/bin/layman || true ''; }; + # Setup polkit as a service + systemd.user.services.polkit-gnome = { + Unit = { + Description = "Polkit gnome authentication agent"; + After = [ "graphical-session.target" ]; + }; + Service = { + Type = "simple"; + ExecStart = + "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1"; + Restart = "on-failure"; + }; + Install = { WantedBy = [ "graphical-session.target" ]; }; + }; ######################### ## Mako (notifications) ######################### diff --git a/modules/linux/user.nix b/modules/linux/user.nix index e2fa986..31f8b8d 100644 --- a/modules/linux/user.nix +++ b/modules/linux/user.nix @@ -5,6 +5,18 @@ let in with lib; { config = mkMerge [ { + security.polkit = { + enable = true; + # TODO: Refine the wheel branch to only include nessicary actions + # extraConfig = '' + # polkit.addRule(function(action, subject) { + # if (subject.isInGroup("wheel")) + # { + # return polkit.Result.YES; + # } + # }) + # ''; + }; environment.shells = [ pkgs.fish ]; users = { # If we install the user and the system is hardended, then disable mutable users