I just installed NixOS with Niri less than a week ago and I’m trying to understand something and also want to know if the way I implemented these things is actually correct.
I have my waybar set up from when I used to use OpenSuse Tumbleweed. I configured it this way:
Line 241 used to work in TW, but not in NixOS. Line 243 did work properly (I got it from Lumo, an LLM). Here I have my first question: Are all program executables in Nix in that path? /run/current-system/sw/bin/
I kept asking Lumo and it suggested doing this:
I added line 81. From what I understad this block of code is adding configurations do my waybar.service. Is this correct? Am I missing anything else?
From this exercise I got a few other questions:
Where are the service files stored in Nix? I know I should not edit them directly. I just want to look them up so I can read them and better understand them.
Is it possible to completely overwrite a service? Using waybar as example: can I completely rewrite the contents of the service file from my configuration.nix file? If so, how should I do it? Is it a good idea?
Thank you! Any and all help is greatly appreciated!
No. All packages installed with nix live in randomly-named paths under /nix/store. You cannot predict, and therefore not hard-code, binary paths.
This is by design; hard-coding paths is like using global variables, it causes issues because different packages may want to use different versions of dependency binaries. By having one “global” binary you make this impossible. It also causes issues for atomicity of updates and other such things.
/run/current-systemcan be used as an escape hatch for some packages if desperately needed, but I recommend against using it as much as possible.
Yes. In fact, it adds the binary directories of those packages to your waybar service. This will make the executables available in $PATH, so you can run them in your on-click handlers.
Your LLM is definitely misleading you though. You should be using:
systemd.user.services.waybar.path = with pkgs; [
wlogout
wleave
pavucontrol
waylogout
pamixer
procps # Has `pkill`
];
… assuming you want the binaries from those packages to be accessible from waybar.
That said, this only works if waybar is executed as a systemd service, who knows how you’re doing that. Could you share your full config so I can see and tell you how to do this correctly?
You can use systemctl status to show service status, it tells you where the service (and the override files) is in the command output.
For user services you need to add --user.
Services completely defined through NixOS you should be able to fully override with lib.mkForce.
Specifically for packages added to systemd.packages (like waybar) I’m not sure if there’s a better way than removing the package from systemd.packages. In your case, you could presumably achieve this by setting programs.waybar.enable to false.
Whether this is a good idea depends on your scenario. In this case you’re using the service defined by waybar upstream to do exactly what it is designed for; it’s unlikely you know better, using overrides through the NixOS module system makes more sense to me than redefining the unit from scratch.
Notably the unit will also be updated alongside the package, which is useful in case changes are needed in the future. It should reduce your maintenance burden.
So, the question is less “is it a good idea” and more “do you really want to do extra work for no reason”.
Awesome. This is exactly how I thought NixOS worked and I’m glad it actually is!
The way you wrote it makes a lot more sense, thank you! I did triplicate the shutdown menus (wlogout, wleave and waylogout because I haven’t picked one yet
I am starting it as a service with programs.waybar.enable = true. This automatically turns the service on.
I did, but I missed where the information was. I believe it’s the line Drop-In, right?
~ ❯❯❯ systemctl --user status waybar.service
● waybar.service - Highly customizable Wayland bar for Sway and Wlroots based compositors
Loaded: loaded (/etc/systemd/user/waybar.service; enabled; preset: ignored)
Drop-In: /nix/store/fkw5grr06yjfmgfzmwc0wh421q3x1qzk-user-units/waybar.service.d
└─overrides.conf
Active: active (running) since Fri 2026-01-02 00:13:28 CST; 12min ago
Invocation: b14e3518852841718e02622c5f0af118
Docs: https://github.com/Alexays/Waybar/wiki/
Main PID: 2136 (.waybar-wrapped)
Tasks: 17 (limit: 37570)
Memory: 28.7M (peak: 29.5M)
CPU: 3.715s
CGroup: /user.slice/user-1000.slice/user@1000.service/app.slice/waybar.service
└─2136 /nix/store/2jkbcl7z4hyzzbfc33n9v13knpl8dwsm-waybar-0.14.0/bin/waybar
Jan 02 00:17:29 alientux-nixos waybar[2136]: Unable to replace properties on 0: Error getting properties for ID
Jan 02 00:18:29 alientux-nixos waybar[2136]: Unable to replace properties on 0: Error getting properties for ID
Jan 02 00:19:29 alientux-nixos waybar[2136]: Unable to replace properties on 0: Error getting properties for ID
Jan 02 00:20:29 alientux-nixos waybar[2136]: Unable to replace properties on 0: Error getting properties for ID
Jan 02 00:21:29 alientux-nixos waybar[2136]: Unable to replace properties on 0: Error getting properties for ID
Jan 02 00:21:29 alientux-nixos waybar[2136]: Unable to replace properties on 0: Error getting properties for ID
Jan 02 00:22:29 alientux-nixos waybar[2136]: Unable to replace properties on 0: Error getting properties for ID
Jan 02 00:23:29 alientux-nixos waybar[2136]: Unable to replace properties on 0: Error getting properties for ID
Jan 02 00:24:29 alientux-nixos waybar[2136]: Unable to replace properties on 0: Error getting properties for ID
Jan 02 00:25:29 alientux-nixos waybar[2136]: Unable to replace properties on 0: Error getting properties for ID
I don’t know how to do this, but now I know where to start looking, thank you very much!
100% agree and I believe my current scenario is better suited for overrides. If I understood correctly this would be done in my configuration.nix', right?
So, in this case the base service definition is in /etc/systemd/user/waybar.service, with overrides coming from the nix store. Systemd will merge these; how exactly that works is described here in the sysyemd docs, just search for drop-in.
The systemd .service file in this case is unfortunately in an FHS directory; systemd doesn’t support ingesting service files dynamically, so those are created with symlinks. NixOS has bits of machinery to ensure services are reloaded and restarted when appropriate.
Yes, that is what happens by default for waybar, too, i.e. you’re already using overrides.
In fact, ideally you configure everything with configuration.nix; everything is possible to do that way. If you do nix can provide you all of its guarantees, and we can see/replicate what you’re doing if you’re running into issues.
That is admittedly the purists’ view, though. Personally that’s how I do things, even to the point of configuring files in my home directory that way, I’m aware many people find this too much effort.
You use systemctl cat to inspect any unit. This will collect the main definition as well as any override and show it on the terminal in a manor that you can inspect.