Install Linuxbrew on Solus

Prerequisites

Install Solus’ Base Development Tools:

# This will provide items such as clang, gcc, make, a multitude of devel sub-packages, and more. 
# Solus' system.devel is similar to packages on other operating systems, such as Debian’s build-essentials.

sudo eopkg install -c system.devel

The solbuild package could be required to build dependencies of some Linuxbrew formulae:

sudo eopkg install solbuild

Install Linuxbrew

The actual Linuxbrew setup consists of two steps, installation and shell profile customization:

Installation

sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"

Shell Configuration

Then add its binary path to your shell’s profile:

# bash: $HOME/.bashrc
# zsh:  $HOME/.zshrc

PATH="/home/linuxbrew/.linuxbrew/bin:$PATH"

Install a brew from a local formula

Finally, I wanted to install termtosvg via Linuxbrew but it’s not yet available as a public formula. However, there was an open pull request that contained the required ruby file which I saved as $HOME/termtosvg.rb and installed with brew install "$HOME/termtosvg.rb".

# termtosvg.rb

class Termtosvg < Formula
  include Language::Python::Virtualenv

  desc "Record terminal sessions as SVG animations"
  homepage "https://nbedos.github.io/termtosvg"
  url "https://github.com/nbedos/termtosvg/archive/0.6.0.tar.gz"
  sha256 "09ccefb75a6a4f8be186b6efdc3cf355cf8de7dc2222b9e4d841d54e623dd261"

  depends_on "python"

  def install
    venv = virtualenv_create(libexec, "python3")
    system libexec/"bin/pip", "install", "-U", "-e", ".[dev]"
    venv.pip_install_and_link buildpath
    bin.install_symlink libexec/"bin/termtosvg"
  end

  test do
    testfile = testpath/"test.svg"
    exec("echo \"termtosvg-test\nexit\" | #{bin}/termtosvg  #{testfile} && grep -q termtosvg-test #{testfile}")
  end
end