hyprwm / hypridle

Hyprland's idle daemon
BSD 3-Clause "New" or "Revised" License
403 stars 25 forks source link

Hypridle as NixOS service not working #41

Closed godexsoft closed 7 months ago

godexsoft commented 7 months ago

I have setup hypridle via flake + home-manager combo. It's then enabled via

services.hypridle = { enable = true; ... }

in my home.nix.

All the configs are written where i expect them and I can see it running via systemctl correctly. The only problem is that it does not actually work this way. However, if i kill it and/or start it directly from command line using exactly the same path i got from ps aux | grep hypridle it works fine :rage4:

Hardware is 2016 Mac book pro. Let me know if you need any more info re my setup :+1: Any help is appreciated :pray:

fufexan commented 7 months ago

Perhaps you have missing variables like PATH. Systemd does not import those by itself.

If you're also using the HM module for Hyprland, make sure you have wayland.windowManager.hyprland.systemd.variables = ["--all"]; so that all variables are imported to systemd.

godexsoft commented 7 months ago

Thanks for the suggestions @fufexan :+1:

I can confirm that it's related to the env - hypridle simply could not find send-notify and other software i was trying to create listeners for. Giving it a full path worked so that confirms it.

At first i did not have hyprland setup through HM. It was configured via the flake and its nixos module. I tried to add the line you recommended and it did not help. However, when i reconfigured hyprland through HM, the line you suggested did help indeed. Everything seems to work now :bow:

In case others experience the same issue in the future but don't want to reconfigure to use HM module - what would be a good way to solve it without the line you provided? How does one force systemd to export the correct env the "nix way"?

fufexan commented 7 months ago

You don't force systemd to export the correct way. HM doesn't do anything special in this regard, only adds this line in your config, which will work on any systemd distro:

exec-once = dbus-update-activation-environment --systemd --all
godexsoft commented 7 months ago

So in short, this needs to be done by hand if not using the HM module, right?
I could not find it in the docs. Would it be a good idea to add it somewhere visible perhaps? Pardon if i just did not look hard enough. But i have a feeling i would not be the only one coming back with this issue.

fufexan commented 7 months ago

So in short, this needs to be done by hand if not using the HM module, right?

Yes.

I could not find it in the docs. Would it be a good idea to add it somewhere visible perhaps?

Sure. I will add it.

fufexan commented 7 months ago

Added in https://github.com/hyprwm/hyprland-wiki/commit/7ffbed85b646ee78a2d7b94775d5179b4c9fd1ce.

I'll also try to change the default systemd.variables value to ["--all"], as I've been using it without issues for the past year.