Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nixos/waybar: use upstream service file #242728

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions nixos/modules/programs/wayland/waybar.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,8 @@ in

config = lib.mkIf cfg.enable {
environment.systemPackages = [ cfg.package ];
systemd.user.services.waybar = {
description = "Waybar as systemd service";
wantedBy = [ "graphical-session.target" ];
partOf = [ "graphical-session.target" ];
script = "${cfg.package}/bin/waybar";
};
systemd.packages = [ cfg.package ];
systemd.user.services.waybar.wantedBy = [ "graphical-session.target" ];
};

meta.maintainers = [ lib.maintainers.FlorianFranzen ];
Expand Down
6 changes: 5 additions & 1 deletion pkgs/by-name/wa/waybar/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
sndio,
spdlog,
sway,
systemd,
udev,
upower,
wayland,
Expand Down Expand Up @@ -120,6 +121,7 @@ stdenv.mkDerivation (finalAttrs: {
libsigcxx
libxkbcommon
spdlog
systemd
wayland
]
++ lib.optionals cavaSupport [
Expand Down Expand Up @@ -166,13 +168,15 @@ stdenv.mkDerivation (finalAttrs: {
"pulseaudio" = pulseSupport;
"rfkill" = rfkillSupport;
"sndio" = sndioSupport;
"systemd" = false;
"systemd" = true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should probably follow the same theme as the other flags if someone wants to build without systemd dependency

Copy link
Contributor Author

@m-bdf m-bdf Aug 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This option only enables copying waybar.service to the correct location (PKG_CONFIG_SYSTEMD_SYSTEMDUSERUNITDIR) during the build, nothing else.

The result waybar binary remains identical as the systemd dependency is never used at runtime, so I don't really see a need to allow disabling it. I even believe a systemdSupport option would actually confuse people by making them think the waybar binary can depend on and use the systemd dependency at runtime.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's what buildInputs (i.e. depsHostTarget) implies, that it's a runtime linkage.
If it's not used at runtime why would it be there?

"tests" = runTests;
"upower_glib" = upowerSupport;
"wireplumber" = wireplumberSupport;
})
++ lib.optional experimentalPatches (lib.mesonBool "experimental" true);

PKG_CONFIG_SYSTEMD_SYSTEMDUSERUNITDIR = "${placeholder "out"}/lib/systemd/user";

postPatch = ''
substituteInPlace include/util/command.hpp \
--replace-fail /bin/sh ${lib.getExe' bash "sh"}
Expand Down