The story of the day
As some of you may, or may not know, in general, when it comes to CLI tools for Kalpa, the existing recommendation is to use a Distrobox, and do your stuff there. This really is a perfectly fine way to do things, but it does add a layer of abstraction, running those things in a container, and can sometimes be a pain in the arse, when it comes to accessing certain things, like USB devices, etc.
I’ve been peripherally helping out here and there with Universal Blue, which are currently offering Bluefin(GNOME), Aurora(Plasma), and Bazzite(Gaming Focused), derived from Fedora Atomic bases. Their default workflow de-emphasizes the use of Toolbox/Distrobox for your CLI needs, and instead leverages Homebrew for that.
I’m sure many of the folks that might be reading this are probably well aware of what homebrew is, particularly if you’re from the MacOS world, but the tl;dr version, is that rather than spinning up a container for your stuff, and installing it there, homebrew acts as a “Repository” that offers up-to-date pre-compiled binaries, that are managed outside of your distributions package management, so it’s got zero impact on your base system.
So this pretty much slots in nicely with Kalpa’s entire ethos, of keeping things out of your system root. The only thing that homebrew requires, of the base system, is the existence of git on the host, in the case of Kalpa (Which isn’t currently included in the default installation) and everything homebrew does, gets installed in /home/linuxbrew/.linuxbrew $HOME is always rw on Kalpa, so this doesn’t break any of our atomic model for updates, and once it’s enabled, it doesn’t require any sudo elevation of privileges.
So I figured I’d give it a shot, and see if it broke anything, to install and start using brew on Kalpa.
And wouldn’t you know it, it “Just Works™”
So what does this all mean for Kalpa?
Well, at the moment, absolutely nothing, I’m not making any changes to the Kalpa defaults, at this point, as including a third-party repository like this within Kalpa has to be handled properly. There’s a few ways that can be done, making it a completely optional addon for users, but I’m not looking into that at present. I’m just going to use it, and see how it goes, and see if I consider it a good move for Kalpa. This blog post is mostly to show folks how to do it, so they can try it out, see how it works for them, and give feedback if it’s something that makes their life/workflow better, brings about peace with honor, and possibly returns the world to some version of a state of sanity.
At the moment, doing this is unsupported, but I do welcome bug reports to be filed at Bugzilla if you run across them, please preface those bug reports with [Homebrew] just so I can sort and see them easily.
As per usual, discussion about such things, simple questions, etc, can be directed to me at:
Ok, fine, would you get to the actual instructions?
Ok, sure, no need to be pushy.
$ sudo transactional-update pkg in git-core
Reboot your machine.
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
$ eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
$ brew install hello
$ hello
To set the appropriate $PATH variable, only within Konsole, run the following:
echo 'if [ $(basename $(printf "%s" "$(ps -p $(ps -p $$ -o ppid=) -o cmd=)" | cut --delimiter " " --fields 1)) = konsole ] ; then '$'\n''eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"'$'\n''fi'$'\n' >> ~/.bashrc
NOTE1: Unfortunately, I haven’t found an easy way to make this work for flatpak’d terminals, such as the yakuake flatpak, but I’ll keep poking at it.
NOTE2: Edit: Yes, I’m just shamelessly stealing the profile.d stuff from Universal Blue for this testing setup (Thanks j0rge and the rest of the ublue folks) If you don’t do it this way, and just set it in ~/.bashrc directly, it makes flatpak very unhappy
And that’s it, you’ve successfully installed brew, and installed the hello package, just to make sure everything works. You can just run brew remove hello and then get on with installing whatever else you’ve got going on.
Denoument
As I said, I’m going to be poking at this on my own development workstation for a while, and seeing if I feel it fits in well with the aims of Kalpa. There are some ways to make this an “easier” install for folks that want it, I’m just not doing them at present, for reasons.
Give it a try and see if you like it.
Extra Credit
Since automatic updates are kind of an important part of things, for Kalpa, I’ve also added the following systemd service and timer, to update homebrew during the nightly maintenance window
$ vim ~/.config/systemd/user/update_brew.service
[Unit]
Description=brew automatic update for %I
After=network.target
StartLimitIntervalSec=60
StartLimitBurst=4
[Service]
ExecStart=/home/linuxbrew/.linuxbrew/bin/brew up
Type=oneshot
Restart=on-failure
RestartSec=1
[Install]
WantedBy=default.target
$ vim ~/.config/systemd/user/update_brew.timer
[Unit]
Description=Daily update of all brew formulae
After=network.target local-fs.target
[Timer]
OnCalendar=daily
AccuracySec=1m
RandomizedDelaySec=2h
Persistent=true
[Install]
WantedBy=timers.target
$ systemctl --user enable update_brew.timer
$ systemctl --user daemon-reload