gpakosz / .tmux

🇫🇷 Oh my tmux! My self-contained, pretty & versatile tmux configuration made with ❤️
MIT License
21.54k stars 3.33k forks source link

When using nix sysctl on MacOS, the '-q' option is not available causing the uptime display to be broken #716

Closed mayersj1 closed 5 months ago

mayersj1 commented 5 months ago

When using nix on MacOS, a sysctl binary is installed in the users .nix-profile space that is present in the PATH before /usr/sbin/sysctl. This sysctl does NOT support the -q option. This results in the uptime display of the status bar to show 54y 48d 16h 39m (much like closed issue #501).

I've verified that if we drop the '-q' arg for *Darwin check in the .tmux.conf, the uptime output is properly displayed.

Would it be possible to just drop the '-q' arg for MacOS? This will allow the uptime to work properly with either sysctl binary.

gpakosz commented 5 months ago

Hello @mayersj1 👋

That or I could specifically call /usr/sbin/sysctl when on macOS. Not sure which is better at that point.

gpakosz commented 5 months ago

Can you please give the gh-716 branch a try? And maybe comment the changes?

mayersj1 commented 5 months ago

So I've verified that the changes to uptime and loadavg work properly on MacOS Sonoma 14.3. Did you want me to comment the code and submit a PR or just note the differences here? Sorry, a little confused as to what you'd like me to do. Thanks!

gpakosz commented 5 months ago

I removed -q and directed stderr to /dev/null. That should do it. I'm about to merge that change now, thanks for testing!

mayersj1 commented 5 months ago

Sure thing! All working well!

gpakosz commented 5 months ago

I'm now curious about why Nix does what it does