mirror of
https://github.com/JakeStanger/ironbar.git
synced 2026-07-11 07:15:19 +01:00
[GH-ISSUE #134] Scripts don't work while running ironbar under a systemd service NixOS #5694
Labels
No labels
A:Build
A:CI
A:Client
A:Config
A:Core
A:Documentation
A:Documentation
A:IPC
A:Testing
A:UX/UI
blocked
BREAKING CHANGE
duplicate
good first issue
GTK4
help wanted
invalid
M:Battery
M:Battery
M:Bindmode
M:Bluetooth
M:Brightness
M:Cairo
M:Clipboard
M:Clock
M:Clock
M:Custom
M:Focused
M:Keyboard
M:Launcher
M:Menu
M:Music
M:Music
M:Music
M:Network Manager
M:Notifications
M:SysInfo
M:Tray
M:Volume
M:Workspaces
partially resolved
P:Critical
P:High
P:Low
P:Medium
pull-request
T:Bug
T:Bug
T:Core Enhancement
T:Module Enhancement
T:New Module
T:Question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
JakeStanger/ironbar#5694
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @yavko on GitHub (May 1, 2023).
Original GitHub issue: https://github.com/JakeStanger/ironbar/issues/134
Describe the bug
Scripts don't work while running ironbar under a systemd service
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Scripts work
System information:
Configuration
Config (generated json from nix)
Additional context
Works while executing normally, and not under systemd service
Screenshots
@yavko commented on GitHub (May 1, 2023):
Also forgot to mention, it only doesn't happen with
on_clickscripts/cmd, example:!do_something@JakeStanger commented on GitHub (May 1, 2023):
I think I know why - the program is spawned as just
shbut systemd won't check PATH. Before I fix, can you confirm/bin/shexists on NixOS pls?@yavko commented on GitHub (May 1, 2023):
It does

@JakeStanger commented on GitHub (May 1, 2023):
If you get a min let me know if the linked PR sorts this.
@yavko commented on GitHub (May 2, 2023):
Why not just eliminate all usage of

sh? Also it's even more broken since I last tried, works fine in terminal, but here is the error i get in systemd@yavko commented on GitHub (May 2, 2023):
Update after restarting my computer an hour ago before I left for school I noticed ironbar started (through systemd) but the script still did not work, I think issue is with the pipe or something
@JakeStanger commented on GitHub (May 2, 2023):
Firstly because it would make this issue worse - systemd units do not read PATH because they have no idea of it, so it would add the requirement for every script to use the absolute path. Also because being able to do bash scripting in your config is neat, and I'd rather not lose that.
I'm not sure what's causing that, but it sure ain't the PR as that literally changes the
shcalls to/bin/sh. I've also not merged any changes to the Wayland code yet. I'd imagine this is likely another issue with running under systemd you'd not encountered up until now (possibly again because it won't read any env vars unless you specifically write them into the unit, or maybe some nix things).I'll try launching it from a systemd unit when I get time and see what happens, but might be a few days as I've got a lot on rn.
@yavko commented on GitHub (May 3, 2023):
makes sense, then
Not sure either but it went away
@JakeStanger commented on GitHub (May 7, 2023):
Have just tested this myself, and it works fine on Arch using the 0.12.0 release build (without the PR).
I used the following systemd user service file:
With a very basic script:
I suspect there's something weird going on with Nix.
@yavko commented on GitHub (May 7, 2023):
It probably is, mine is super similar
@yavko commented on GitHub (May 7, 2023):
Could you try running the nix version under arch?
then the built thing from a service?
@JakeStanger commented on GitHub (May 7, 2023):
Just tested using the same config as I used before (not managed through nix) and your systemd user unit, and it works fine
@yavko commented on GitHub (May 7, 2023):
Weird, let me get back trace working to see why it wont get output
@yavko commented on GitHub (May 7, 2023):
Before even adding the environment variable, it seems path is just gone, not only that, the mpris widget doesn't work anymore ?!? Let me try rebooting
EDIT: Music works, I'm just dumb
@JakeStanger commented on GitHub (May 7, 2023):
I've just tried
{ type = "script" cmd = "echo $PATH"}with the Nix build/systemd unit on Arch and that does work as expected with the full path.@yavko commented on GitHub (May 7, 2023):
Figured it out, so typical nix thing, in my scripts I didn't add runtime deps, so yeah ..., I am sorry for wasting your time on this, but actually you did fix it with that PR, since it's referenced directly, and sh isn't in path, maybe? So yeah just merge it. This issue has been weird as it kept having different error messages, once again I am sorry.
@JakeStanger commented on GitHub (May 7, 2023):
No need to apologise, issues like this are commonplace in software dev and sometimes you just need to whittle your way down to find the actual issue, and often it's hidden in plain sight. I'm glad we managed to get there :)