# Polkit not working in Hyprland

**URL:** https://discourse.nixos.org/t/polkit-not-working-in-hyprland/58861
**Category:** Help
**Created:** [January 15, 2025, 4:06pm UTC](https://discourse.nixos.org/t/polkit-not-working-in-hyprland/58861 "2025-01-15T16:06:16Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![sharwesh](https://discourse.nixos.org/letter_avatar_proxy/v4/letter/s/e9a140/32.png) [@sharwesh](https://discourse.nixos.org/u/sharwesh)
#### Post date: [January 15, 2025, 4:06pm UTC](https://discourse.nixos.org/t/polkit-not-working-in-hyprland/58861/1 "2025-01-15T16:06:16Z")

</div>

I am currently using Hyprland and everything works fine but while using it i tried access config.nix at vscode ,while saving it says polkit auth any suggestions to solve it

---

<div class="post-metadata">

### Author: ![Postboote](https://discourse.nixos.org/user_avatar/discourse.nixos.org/postboote/32/28003_2.png) [@Postboote](https://discourse.nixos.org/u/Postboote)
#### Post date: [January 15, 2025, 4:20pm UTC](https://discourse.nixos.org/t/polkit-not-working-in-hyprland/58861/2 "2025-01-15T16:20:07Z")

</div>

So for me it works with

```auto
  services.gnome.gnome-keyring.enable = true;
  security.pam.services.hyprland.enableGnomeKeyring = true;

```

Also make sure vscode is installed via Home Manager.  
This will save you a lot of trouble in terms of extensions in the future

---

<div class="post-metadata">

### Author: ![sharwesh](https://discourse.nixos.org/letter_avatar_proxy/v4/letter/s/e9a140/32.png) [@sharwesh](https://discourse.nixos.org/u/sharwesh)
#### Post date: [January 15, 2025, 4:43pm UTC](https://discourse.nixos.org/t/polkit-not-working-in-hyprland/58861/3 "2025-01-15T16:43:43Z")

</div>

it didnt work for me any other option

---

<div class="post-metadata">

### Author: ![Postboote](https://discourse.nixos.org/user_avatar/discourse.nixos.org/postboote/32/28003_2.png) [@Postboote](https://discourse.nixos.org/u/Postboote)
#### Post date: [January 15, 2025, 5:38pm UTC](https://discourse.nixos.org/t/polkit-not-working-in-hyprland/58861/4 "2025-01-15T17:38:48Z")

</div>

So try:

```auto
security.polkit.enable=true;

```

install libsForQt5.polkit-kde-agent in your system enviroment packages and finally add `"systemctl --user start plasma-polkit-agent"` in your hyprland exec-once.  
For the problem with VS code there are more than one solutions.

1. (not recommended) chown the directory so your user has privileges there.
2. make an etc directory in your home directory and link it to /etc/nixos:

```auto
mkdir ~/etc
sudo mv /etc/nixos ~/etc/
sudo chown -R $(id -un):users ~/etc/nixos
sudo ln -s ~/etc/nixos /etc/

#code ~/etc/nixos/
codium ~/etc/nixos/

```

1. edit your configuration in your home directory. For rebuilding enter this command to rebuild from a different directory `nixos-rebuild switch -I nixos-config=$HOME/etc/nixos/configuration.nix`.

For me the auth. agent works for example when using gparted. But for VS code it does not.  
So the solutions mentioned before are best suited.

---

<div class="post-metadata">

### Author: ![sharwesh](https://discourse.nixos.org/letter_avatar_proxy/v4/letter/s/e9a140/32.png) [@sharwesh](https://discourse.nixos.org/u/sharwesh)
#### Post date: [January 17, 2025, 3:24pm UTC](https://discourse.nixos.org/t/polkit-not-working-in-hyprland/58861/5 "2025-01-17T15:24:29Z")

</div>

this worked thanks and alse i tried this which also worked

#Polkit agent  
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;  
};  
};  
};
