Closed yavko closed 1 year ago
Also forgot to mention, it only doesn't happen with on_click
scripts/cmd, example: !do_something
I think I know why - the program is spawned as just sh
but systemd won't check PATH. Before I fix, can you confirm /bin/sh
exists on NixOS pls?
I think I know why - the program is spawned as just
sh
but systemd won't check PATH. Before I fix, can you confirm/bin/sh
exists on NixOS pls?
It does
If you get a min let me know if the linked PR sorts this.
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
not sure if its from this PR, or just from other master changes
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
Why not just eliminate all usage of
sh
?
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.
Also it's even more broken since I last tried, works fine in terminal, but here is the error i get in systemd
I'm not sure what's causing that, but it sure ain't the PR as that literally changes the sh
calls 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.
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.
makes sense, then
I'm not sure what's causing that, but it sure ain't the PR as that literally changes the sh calls 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).
Not sure either but it went away
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:
❯ cat .config/systemd/user/ironbar.service
[Unit]
Description=Ironbar
[Service]
ExecStart=/usr/bin/ironbar
Restart=on-failure
RestartSec=1s
[Install]
WantedBy=default.target
With a very basic script:
let {
$test = { type = "script" cmd = "echo 'hello world'"}
} in {
start = [ $test ]
}
I suspect there's something weird going on with Nix.
I suspect there's something weird going on with Nix.
It probably is, mine is super similar
its the one I have autogenerated with the flake
[Install]
WantedBy=hyprland-session.target
WantedBy=sway-session.target
[Service]
ExecStart=/nix/store/z8a1n04wsrmylr683rd75z9w8n6ryy88-ironbar-0.11.0+date=2023-05-01_31a57ae/bin/ironbar
Type=simple
[Unit]
Description=Systemd service for Ironbar
Requires=graphical-session.target
Could you try running the nix version under arch?
sudo pacman -S nix
mkdir -p ~/.config/nix
echo "experimental-features = nix-command flakes" >> ~/.config/nix/nix.conf
nix build
then the built thing from a service?
Just tested using the same config as I used before (not managed through nix) and your systemd user unit, and it works fine
Just tested using the same config as I used before (not managed through nix) and your systemd user unit, and it works fine
Weird, let me get back trace working to see why it wont get output
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
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.
Just tested using the same config as I used before (not managed through nix) and your systemd user unit, and it works fine
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.
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 :)
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)
```json { "anchor_to_edges": true, "center": [ { "bar": [ { "class": "music-img-img", "src": "{{poll:5000:playerctl metadata mpris:artUrl}}", "type": "image" } ], "class": "music-img", "name": "music-img", "on_mouse_enter": { "cmd": "/nix/store/7kaxirybmsqz1wnq290aj9fifwgdisjx-mctrls-shower/bin/mctrls-shower" }, "on_mouse_exit": { "cmd": "/nix/store/c6swqv9dw2sbiw5zsxar5f3s5zl1m0ix-mctrls-hider/bin/mctrls-hider" }, "type": "custom" }, { "format": "{title}", "icons": { "pause": "icon:media-playback-pause", "play": "icon:media-playback-start" }, "music_dir": "/home/yavor/Music", "on_mouse_enter": { "cmd": "/nix/store/7kaxirybmsqz1wnq290aj9fifwgdisjx-mctrls-shower/bin/mctrls-shower" }, "on_mouse_exit": { "cmd": "/nix/store/c6swqv9dw2sbiw5zsxar5f3s5zl1m0ix-mctrls-hider/bin/mctrls-hider" }, "player_type": "mpris", "show_status_icon": false, "truncate": "end", "type": "music" }, { "bar": [ { "class": "music-ctrls-prev", "label": "玲", "on_click": "!/nix/store/nxip05k3sg7m937vvavjpfdak6k3ica0-iron-previous/bin/iron-previous", "type": "button" }, { "class": "music-ctrls-pp", "label": "{{poll:100:/nix/store/jha3arpk5fpcspbam0nkdrrdsvx79l09-pp-icon/bin/pp-icon}}", "on_click": "!/nix/store/rqacrmlhvwnmp90i88wmmx14bismvjp2-iron-play-pause/bin/iron-play-pause", "type": "button" }, { "class": "music-ctrls-next", "label": "怜", "on_click": "!/nix/store/qf2246j28xybmz7h9yb23nxi4b0yhm13-iron-next/bin/iron-next", "type": "button" } ], "class": "music-ctrls", "name": "music-ctrls", "on_mouse_enter": { "cmd": "/nix/store/7kaxirybmsqz1wnq290aj9fifwgdisjx-mctrls-shower/bin/mctrls-shower" }, "on_mouse_exit": { "cmd": "/nix/store/c6swqv9dw2sbiw5zsxar5f3s5zl1m0ix-mctrls-hider/bin/mctrls-hider" }, "show_if": { "cmd": "/nix/store/i9mm84k7myf1fis2xgnbsqxj3jd1ygn6-mctrls-checker/bin/mctrls-checker", "interval": 500, "mode": "poll" }, "transition_type": "slide_start", "type": "custom" } ], "end": [ { "type": "tray" }, { "format": [ " {cpu_percent}%", " {memory_percent}%" ], "type": "sys_info" }, { "bar": [ { "label": "", "name": "power-btn", "on_click": "popup:toggle", "type": "button" } ], "class": "power-menu", "popup": [ { "orientation": "vertical", "type": "box", "widgets": [ { "label": "Power menu", "name": "header", "type": "label" }, { "type": "box", "widgets": [ { "class": "power-btn", "label": "", "on_click": "!shutdown now", "type": "button" }, { "class": "power-btn", "label": "", "on_click": "!reboot", "type": "button" } ] }, { "label": "Uptime: {{30000:/nix/store/ws0j8bcqxcy08d664cbbbg6j0xlg1vg6-fmt-uptime/bin/fmt-uptime}}", "name": "uptime", "type": "label" } ] } ], "tooltip": "Up: {{30000:/nix/store/ws0j8bcqxcy08d664cbbbg6j0xlg1vg6-fmt-uptime/bin/fmt-uptime}}", "type": "custom" }, { "format": "%l:%M %P", "type": "clock" } ], "height": 32, "icon_theme": "Papirus-Dark", "position": "top", "start": [ { "bar": [ { "label": "", "on_click": "!hyprctl dispatch exec \"zsh -c 'rofi -show drun'\"", "type": "button" } ], "class": "nix-launcher", "name": "nix-launcher", "type": "custom" }, { "all_monitors": false, "name_map": { "1": "●", "10": "●", "2": "●", "3": "●", "4": "●", "5": "●", "6": "●", "7": "●", "8": "●", "9": "●" }, "type": "workspaces" } ] } ```Additional context
Works while executing normally, and not under systemd service
Screenshots