33 lines
947 B
Nix
33 lines
947 B
Nix
{ config, pkgs, ... }:
|
|
|
|
let
|
|
waybarPath = "${pkgs.waybar}/bin/waybar";
|
|
|
|
# Pick the first normal user
|
|
normalUsers = builtins.filter (u: (config.users.users.${u}.isNormalUser or false) != false) (builtins.attrNames config.users.users);
|
|
myUser = if normalUsers == [] then builtins.head (builtins.attrNames config.users.users) else builtins.head normalUsers;
|
|
|
|
# Compute UID safely
|
|
myUid = config.users.users.${myUser}.uid;
|
|
in
|
|
{
|
|
environment.systemPackages = [ pkgs.waybar ];
|
|
|
|
systemd.user.services.waybar = {
|
|
description = "Waybar for Hyprland";
|
|
after = [ "graphical-session.target" ];
|
|
|
|
serviceConfig = {
|
|
ExecStart = "${waybarPath}";
|
|
Restart = "always";
|
|
Environment = ''
|
|
WAYLAND_DISPLAY=${config.environment.sessionVariables.WAYLAND_DISPLAY or "wayland-0"}
|
|
XDG_CURRENT_DESKTOP=Hyprland
|
|
XDG_RUNTIME_DIR=/run/user/${myUid}
|
|
'';
|
|
};
|
|
|
|
wantedBy = [ "default.target" ];
|
|
};
|
|
}
|