Skip to content

Instantly share code, notes, and snippets.

@practicalli-johnny
Last active May 18, 2022 09:49
Show Gist options
  • Save practicalli-johnny/96c7dc086541aa871f4b3425d1583708 to your computer and use it in GitHub Desktop.
Save practicalli-johnny/96c7dc086541aa871f4b3425d1583708 to your computer and use it in GitHub Desktop.
Regolith Linux install on Sidious

Install Regolith Linux Ubuntu 20.04 EFI ISO

Use entire Laptop hard disk (No LLVM)

Post Install

Boot Regolith Linux (do not use desktop login)

Ctrl-Alt-F2 for terminal login

vim ~/.profile

Add XDG Environment Variables

# Encourage applications to use XDG basedir specification for configuration files
export XDG_CONFIG_HOME=$HOME/.config
export XDG_DATA_HOME=$HOME/.local/share
export XDG_STATE_HOME=$HOME/.local/state
export XDG_CACHE_HOME=$HOME/.cache

Reboot operating system - Ctrl-Alt-Del

Install zsh

Install zsh, zsh-doc and git packages from Ubuntu software center

sudo apt -y install zsh zsh-doc git

Start Zsh

zsh

Select 0 to stop the zsh configuration wizzard, prezto will take care of this

Clone prezto into the XDG_CONFIG_HOME/zsh/.zprezto location

git clone --recursive https://github.com/sorin-ionescu/prezto.git "${XDG_CONFIG_HOME}/zsh/.zprezto"

Set ZDOTDIR in terminal to run script to create links for prezto dot files

export ZDOTDIR="${ZDOTDIR:=$XDG_CONFIG_HOME/zsh}"

run the script with the XDG location

setopt EXTENDED_GLOB
for rcfile in "${ZDOTDIR:-$HOME}"/.zprezto/runcoms/^README.md(.N); do
  ln -s "$rcfile" "${ZDOTDIR:-$HOME}/.${rcfile:t}"
done

When prezto dot files are changed, first copy them from .zprezto/runcoms

  • zshenv - add XDG and ZDOTDIR environment variables
  • zpretorc - add modules, themes and other customisations
  • zshrc - powerline10k configuration - added by wizzard

Bootstrap the prezto configuration for the XDG location

Prezto requires ~/.zshenv to bootstrap the location of prezto configuration. The ~/.zshenv file can be a symbolic link to XDG_CONFIG_HOME/zsh/.zshenv

Set the XDG_CONFIG_HOME location to HOME/.config for all applications if not set in ~/.profile

Set the ZDOTDIR location so Zsh can find the Prezto configuration.

# Set XDG_CONFIG_HOME for clean management of configuration files
export XDG_CONFIG_HOME="${XDG_CONFIG_HOME:=$HOME/.config}"
export ZDOTDIR="${ZDOTDIR:=$XDG_CONFIG_HOME/zsh}"

Set Zsh as the default shell

chsh -s /usr/bin/zsh

Create a link to XDG_CONFIG_HOME/zsh/.zshenv from ~/.zshenv to set prezto configuration on login

ln -s $XDG_CONFIG_HOME/zsh/.zshenv $HOME/.zshenv

To test, source $HOME/.zshenv and type zsh to open a new shell session

Logout / login the desktop and open a terminal which should show the default sorin theme for zsh

Powerline 10k

edit $XDG_CONFIG_HOME/zsh/.zpreztorc and change zstyle :prezto:module:prompt theme to the powerlevel10k theme

zstyle :prezto:module:prompt theme powerlevel10k

Download fonts to make powerline10k even nicer https://github.com/romkatv/powerlevel10k#fonts

Make a local fonts directory and move the downloaded fonts

mkdir ~/.local/share/fonts
mv -v ~/Downloads/*.ttf ~/.local/share/fonts/

Open a terminal (or run zsh) and the powershell10k will run a wizzard to visually select the style of prompt theme. The wizzard will write the configuration to ~/.config/zsh/.zshrc

Neovim

Neovim supports an excellent Clojure experience, using Neovim as an lsp client and Conjure as the Clojure REPL Neovim 0.7.0 is latest (0.7.0 minimum for nvim-treesitter plugin)

https://github.com/neovim/neovim/releases/tag/v0.7.0

Install neovim 070 .deb file - sudo dpkg -i nvim-linux64.deb

Install dependencies

  • sudo apt install ripgrep fd-find libstdc++-10-dev

Node.js seems to be a dependency for nvim-treesitter https://nodejs.org/en/download/ Install current node.js in ~/.local/apps/node and create a symbolic link in ~/.local/bin for node and npm

ln -s ~/.local/apps/node/current/bin/node ~/.local/bin/node  
ln -s ~/.local/apps/node/current/bin/npm ~/.local/bin/npm
ln -s ~/.local/apps/node/current/bin/npx ~/.local/bin/npx

If ~/.local/bin directory was created after login, then either source ~/.profile or logout/login of desktop to add ~/.local/bin to the operating system execution path

Clojure a nice fennel based configuration https://github.com/rafaeldelboni/nvim-fennel-lsp-conjure-as-clojure-ide.git

Clone ... ~/projects/community/vim/nvim-fennel...

Run nvim command in a terminal

Run the command :PackerInstall

Error detected while processing /home/practicalli/.local/share/nvim/site/pack/packer/start/aniseed/plugin/anisee d.vim: line 3: No C compiler found! "cc", "gcc", "clang", "cl", "zig" are not executable.

TODO: review practicalli additons

Git and GitHub

Install the Git command line client

sudo apt install git

Configure git user identity

mkdir  $XDG_CONFIG_HOME/git && touch  $XDG_CONFIG_HOME/git/config 
git config --global user.name "John Practicalli"
git config --global user.email "250870+practicalli-john@users.noreply.github.com"

Configure Git with a global ignore file and use of diff3

git config --global core.excludesFile ignore-global
git config --global merge.conflictstyle diff3

Optionally set git hooks and scripts by defining a template directory

mkdir  $XDG_CONFIG_HOME/git/template
git config --global init.templatedir template

Create an SSH public/private key

ssh-keygen -t rsa -C john@practical.li

Add a new SSH key to the GitHub account

cat .ssh/id_rsa.pub

Copy the output into the GitHub web page for addng a new key

  • .gitconfig to XDG_CONFIG_HOME/git/config
  • .gitignore-global to XDG_CONFIG_HOME/git/ignore-global

Add the global excludes file to the Git config file using relative location (keep them both in the same XDG_CONFIG_HOME/git directory)

git config --global core.excludesFile ignore-global

XDG_CONFIG_HOME/git/template is a common location for scripts and hooks that should be added to a newly created Git repository, in the .git directory. The template location is set by init.templatedir

git config --global init.templatedir template

Install Clojure and dev tools

Linux install from Clojure.org https://clojure.org/guides/getting_started#_installation_on_linux

Install curl to download the Clojure CLI install

sudo apt install curl

Download the Clojure CLI install file

curl -O https://download.clojure.org/install/linux-install-1.11.1.1113.sh

Make the install file executable

chmod +x linux-install-1.11.1.1113.sh

Install in /usr/local/bin (preferred location as there are libs and man pages as part of the install)

sudo ./linux-install-1.11.1.1113.sh

Output

Installing libs into /usr/local/lib/clojure
Installing clojure and clj into /usr/local/bin
Installing man pages into /usr/local/share/man/man1

Test Clojure is working, either command

clojure -Sdescribe
clojure --version

rlwrap is not installed as Rebel Readline is used instead

Install practicalli/clojure-deps-edn

git clone git@github.com:practicalli/clojure-deps-edn.git $XDG_CONFIG_HOME/clojure

Test aliases by running Rebel REPL

clojure -M:repl/rebel

Clojure LSP

Download the latest release https://github.com/clojure-lsp/clojure-lsp/releases

For Ubuntu and other Linux OS's: clojure-lsp-native-linux-amd64.zip

Extract clojure-lsp executable from the downloaded archive to .local/bin/

Emacs 28

Steps to build Emacs 28

sudo apt build-dep emacs

Clone source from a nearby mirror, as listed on https://www.gnu.org/software/emacs/download.html#gnu-linux e.g. emacs-28.1.tar.xz from https://mirror.koddos.net/gnu/emacs/

Ask Ubuntu to calculate the packages required to build Emacs from source

sudo apt build-dep emacs
  • Install native compiler used by Emacs
sudo apt install libgccjit0 libgccjit-10-dev
  • Install fast JSON stuff
sudo apt install libjansson4 libjansson-dev

To avoid certificate issues, ensure gnutls-bin is installed

sudo apt-get install gnutls-bin
  • Download Emacs source

Visit a nearby GNU mirror https://www.gnu.org/software/emacs/download.html#gnu-linux

I was directed to http://ftp.snt.utwente.nl/pub/software/gnu/emacs/

Download Emacs 28.1 source code, either tar.gz or tar.xz Extract the source code (I used the archive tool)

Change into the emacs28.1 directory

cd emacs28-1

Inform the Emacs configuration script as to the location of gcc-10, otherwise it fails to find libgccjit

Error message:

configure: error: ELisp native compiler was requested, but libgccjit was not found.
Please try installing libgccjit or a similar package.

Set these environment variables to define the location of gcc-10

export CC=/usr/bin/gcc-10
export CXX=/usr/bin/gcc-10

Run the autogeneration script

./autogen.sh

Run the configuration script with the native compilation flag

./configure --with-native-compilation --with-harfbuzz

./configure --help to see the flags available

The Optional Features: section of the configure file contains a list of options to use with configure along with brief descriptions

For many features, if the library is found when running ./configure then that feature is enabled

build the emacs binary with all available cpu's

make -j$(nproc)

Test emacs runs

./src/emacs -Q

Remove the ~/.emacs.d directory

Spacemacs

Clone spacemacs to $XDG_CONFIG_HOME/emacs

git clone https://github.com/syl20bnr/spacemacs $XDG_CONFIG_HOME/emacs

SPACEMACSDIR environment variable is used by Spacemacs to set the dotspacemacs-directory, defining where to look for the Spacemacs specific init.el file.

Set SPACEMACSDIR to XDG_CONFIG_HOME/spacemacs in ~/.profile`

# Ensure XDG_CONFIG_HOME is set when launching apps from destktop
export XDG_CONFIG_HOME="$HOME/.config"

# Ensure Emacs can find the location of Spacemacs configuration
# when using a desktop launcher
export SPACEMACSDIR="$XDG_CONFIG_HOME/spacemacs"

Install fira code fints

sudp apt install fonts-firacode

Run emacs (initially use a terminal and source ~/.profile first)

Install fonts for Doom modeline in Emacs

SPC SPC all-the-icons-install-fonts

Create a spacemacs.desktop file to launch via the desktop (logout/login desktop after SPACEMACSDIR is set in .profile)

authinfo secure credentials

Connection credentials that include sensitive data (passwords, developer tokens) can be stored in authinfo.pgp, a PGP encrypted file. This providing an extra level of security for sensitive data.

Magit Forge uses authinfo.gpg to define a connection to GitHub or GitLab that includes a developer token.

practicalli/spacemacs.d defines the XDG location for authinfo.pgp

  ;; Use XDG_CONFIG_HOME location or HOME
  (setq auth-sources (list
                      (concat (getenv "XDG_CONFIG_HOME") "/authinfo.gpg")
                      "~/.authinfo.gpg"))

Create an authinfo.gpg file (or copy a backup if the token is still current) https://practical.li/spacemacs/source-control/forge-configuration.html#create-an-encrypted-authinfogpg-file

command line tools for Emacs / Spacemacs

OpenSSH server for copying files

The easiest way to copy files on the local network is using sftp connection that can be created in nautilus > Other Locations. This requires openssl server to be installed

sudo apt install openssh-server

Check the local IP address of the computer to connect to via sftp, the address should be 192.168.x.x

ifconfig

Open nautilus in the computer that will connect, select Other Locations. In the Connect to Server text box, enter the connection

sftp://192.168.x.x/home/username

The username directory will open and can be browsed as a local directory

Screencasts

Peek - https://github.com/phw/peek Add the Ubuntu PPA

sudo add-apt-repository ppa:peek-developers/stable
sudo apt update
sudo apt install peek

Disable screencast setting for Regolith / i3 desktop as gnome-flashback does not implment the screencast interface Peek will use ffmpeg for the screen recorder backend

Open a terminal and run the following command

gsettings set org.gnome.gnome-flashback screencast false

Gifski - high quality animaged gif images https://gif.ski/ Peek also recommends using this tool to generate animated gifs from its videos

Download the deb file https://github.com/ImageOptim/gifski/releases

Install

sudo dpkg -i gifski_1.6.4_amd64.deb

Convert a video (e.g. a screencast from peek)

gifski --fps 10 --width 720 -o anim.gif video.mpv

A width of 720 gives a readable file without being too large. 1080 width will be double the size, although very easy to read.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment