Skip to content

Instantly share code, notes, and snippets.

@llimllib
Last active June 12, 2023 16:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save llimllib/c032d402b3148a7f9a3b90fd3088f95a to your computer and use it in GitHub Desktop.
Save llimllib/c032d402b3148a7f9a3b90fd3088f95a to your computer and use it in GitHub Desktop.
# https://voidlinux.org/usage/xbps/ is a handy site for docs that isn't linked
# from the docs page, for whatever reason. Gives good xbps-* examples
# install non-free repository:
sudo xbps-install void-repo-nonfree
# update the system; all installs failed before this:
sudo xbps-install -Su
# xbps is hard to type. Add these aliases to your bashrc if xbps-install is
# available
command -v xbps-install > /dev/null && \
alias install="sudo xbps-install -y" && \
alias query="xbps-query -Rs"
# install some packages
# gst-libav is for enabling mp4 support in firefox
# netmount is a service that will mount your /etc/fstab entries on startup
# and unmount them at shutdown
# pkg-config is for building python libs, I don't really know or care what it
# really does
sudo xbps-install \
font-inconsolata-otf \
fzf \
gcc \
git \
gnome-screenshot \
gst-libav \
mpv \
netmount \
nfs-utils \
pkg-config \
ripgrep \
socklog-void \
spotify \
vim-huge \
xclip \
xz
# A runsvdir is a directory in /etc/runit/runsvdir containing enabled services
# in the form of symlinks to service directories. On a running system, the
# current runsvdir is accessible via the /var/service symlink.
#
# https://docs.voidlinux.org/config/services/index.html
# enable logging
# https://docs.voidlinux.org/config/services/logging.html
sudo ln -s /etc/sv/socklog-unix /var/service
sudo ln -s /etc/sv/nanoklogd /var/service/
# enable and start the rpcbind and statd service; needed for nfs
# https://wiki.voidlinux.org/Network_filesystem
sudo ln -s /etc/sv/rpcbind /var/service
sudo ln -s /etc/sv/statd /var/service
sudo ln -s /etc/sv/netmount /var/service
# remove two services that were polluting my logs with errors. Should I learn
# what these are? nahhhhh
sudo rm /var/service/agetty-hvc0
sudo rm /var/service/agetty-hvsi0
# now we're able to mount our NFS
sudo mkdir /mnt/homes
sudo mkdir /mnt/video
echo "192.168.173.2:/volume1/video /mnt/video nfs rw,hard,intr 0 0" | \
sudo tee -a /etc/fstab > /dev/null
echo "192.168.173.2:/volume1/homes /mnt/homes nfs rw,hard,intr 0 0" | \
sudo tee -a /etc/fstab > /dev/null
sudo mount /mnt/homes
sudo mount /mnt/video
# properly set date and time (https://docs.voidlinux.org/config/date-time.html)
sudo ln -sf /usr/share/zoneinfo/US/Eastern /etc/localtime
# create a ~/code directory
mkdir code
cd code
# install the void-packages repo, which contains void's "restricted packages".
# necessary for slack
# https://github.com/void-linux/void-packages#quick-start
git clone git://github.com/void-linux/void-packages.git
cd void-packages
./xbps-src binary-bootstrap
# allow restricted packages
echo XBPS_ALLOW_RESTRICTED=yes >> etc/conf
# install slack (remember, we must be in the ~/code/void-packages dir to do
# this)
./xbps-src pkg slack-desktop
sudo xbps-install --repository hostdir/binpkgs/nonfree slack-desktop
# back to home dir
cd
# in keyboard prefs:
# add super+tab as "cycle through open windows" shortcut
# add super+` as "cycle through open windows of the same application" shortcut
# set caps lock -> esc
# settings -> keyboard -> layouts -> options -> caps lock behavior -> make caps lock an additional esc key
# hit an issue where the start menu became nonfunctional:
# https://github.com/void-linux/void-packages/issues/23383
# generate a new key (has interactive prompts)
ssh-keygen -t rsa -b 4096 -C "bill@billmill.org"
ssh-add ~/.ssh/id_rsa
# add this key to github
# set up git global config
git config --global user.email "bill@billmill.org"
git config --global user.name "Bill Mill"
# install an up-to-date firefox. void came with ESR, which at time of writing
# is 68 while 78 is the latest. Ideally, I'd like to have this fully scripted,
# but I don't know how to get whatever the latest firefox is
#
# visit firefox.com, it offers a tarball, download it
# tar -xjf firefox-78.0.1.tar.bz2
# mkdir ~/Software
# mv firefox ~/Software/
# sudo ln -sf ~/Software/firefox/firefox /usr/local/bin/firefox
#
# install lastpass, ublock origin, reddit enhancement suite
#
# to get this firefox into the start menu, right click on the application launcher and configure -> menu -> open the menu editor -> new item
# let's try to fix the hardware acceleration:
# https://docs.voidlinux.org/config/graphical-session/graphics-drivers/intel.html
sudo xbps-install \
intel-video-accel \
linux-firmware-intel \
mesa-dri \
mesa-vulkan-intel \
vulkan-loader
# I have a coffee lake intel, so I shouldn't need to do the iommu kernel param
# thing they mention on that page. To figure that out, I did:
cat /proc/cpuinfo
# then I took the cpu model to wiki and looked it up. I don't see anywhere in
# the output that it tells you directly, or know how to get that information
# maybe after a restart it will be fixed?
# narrator: it was not
# what I did instead was go into about:config and enable firefox hardware
# acceleration, which may have fixed the problem
# layers.acceleration.disabled was set to on
# layers.acceleration.force-enabled was set to false
# I flipped both those values
# there's still some weird stuff going on here, but I"m going to put it down
# for now
# a few restarts later, and I'm not seeing it anymore? no idea really.
# copy dotfiles from nina
cp /mnt/homes/llimllib/nina_dotfiles_7_4_20/.bashrc .
cp /mnt/homes/llimllib/nina_dotfiles_7_4_20/.vimrc .
cp /mnt/homes/llimllib/nina_dotfiles_7_4_20/.inputrc .
cp /mnt/homes/llimllib/nina_dotfiles_7_4_20/.gitconfig .
# copy base2tone-spacedark
mkdir .vim/colors
cp /mnt/homes/llimllib/nina_dotfiles_7_4_20/Base2Tone_SpaceDark.vim \
~/.vim/colors/
# to fix the matching parens issue, I had to update the MatchParen command in
# my color theme to this:
call <sid>hi("MatchParen", "", s:gui03, "", s:cterm03, "")
# which I figured out by following traces from this issue:
# https://github.com/chriskempson/base16-vim/issues/63
# install vim-plug
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
# in vim, run `:PlugUpdate` to get everything up and running
# update terminal preferences, set super+right and super+left for tab next and
# tab previous, respectively
# update cinnamon preferences, change tile left and tile right to
# shift+super+left and shift+super+right, to not interfere with terminal
# shortcut changes
# make meta the copy/paste key in firefox:
# http://www.relud.com/cmd.html (interesting page about configuring cmd)
# change ui.key.accelKey to 224
# oh actually that wants you to do a bunch of xmodmap hackery, yeesh. I undid
# that change for now
# do I want to use xmodmap or xkb? Do they even do the same thing? very unclear
# to me. My kingdom for karabiner in linux.
#
# figured it out! go to keyboard options -> layouts -> options -> alt/win key
# behavior and select "meta is mapped to Win", then change ui.key.accelKey to
# 224, and :boom: you got it
#
# note that 224 -> 91 if you're using wayland, according to what I read
# cinnamon wants to open up a debugger when you hit <super>l, change that
# shortcut:
gsettings set org.cinnamon.desktop.keybindings looking-glass-keybinding "['<Alt><Super>l']"
# use emacs keys (ctrl-a for beginning, ctrl-e for end)
gsettings set org.cinnamon.desktop.interface gtk-key-theme 'Emacs'
# my bash themes are broken! so to fix them we need to install node:
git clone https://github.com/nodenv/nodenv.git ~/.nodenv
cd ~/.nodenv && src/configure && make -C src
./bin/nodenv init
cd
# install node-build, nodenv is useless without really. Before this runs, make
# sure that nodenv is in your path and initted
mkdir -p "$(nodenv root)"/plugins
git clone https://github.com/nodenv/node-build.git "$(nodenv root)"/plugins/node-build
nodenv install 12.18.2
nodenv global 12.18.2
# need python available for it too, so here goes pyenv:
git clone https://github.com/pyenv/pyenv.git ~/.pyenv
# to build pythons, we need some devel libraries:
sudo xbps-install \
bzip2-devel \
libffi-devel \
libressl-devel \
libxml2-devel \
readline readline-devel \
sqlite-devel \
zlib-devel
pyenv install 3.8.3
pyenv global 3.8.3
# execute the base2term-spacedark shell script from my base2term repo and
# restart gnome-terminal
# Stop cinnamon from opening up the calendar when I hit <Super>c
# at first, I thought this would be in gsettings, so I looked with:
gsettings list-recursively | grep Super
# and was disappointed when it wasn't there! It turns out that cinnamon applets
# live on their own in /usr/share/cinnamon/applets, and there we can find the
# offending shortcut:
#
# $ rg 'Super>c'
# notifications@cinnamon.org/settings-schema.json
# 35: "default": "<Shift><Super>c",
#
# calendar@cinnamon.org/settings-schema.json
# 41: "default": "<Super>c",
#
# it says "default" - but I don't see any way to change it other than editing
# it in the source code? Surely there must be one?
#
# ah ha, it's under the applets system preferences panel! click the gear icon
# and assign another shortcut
#
# (if cinnamon doesn't store that in gsettings, where the hell does it store
# it? whatever, I got a life to live.)
#
# and wahoo, I have super+c and super+v as c+p in terminal
#
# also go to applets -> grouped window list -> hotkey for cycling through
# thumbnail menus and change to "unassigned"
# no login
# --------------
# https://wiki.archlinux.org/index.php/LXDM suggests editing /etc/lxdm/lxdm.conf
# to have an autologin=llimllib line
#
# oddly, there was an uncommented autologin line with `anon` specified already;
# I changed it to llimllib; this worked.
# why is shutdown hanging on unmounting?
#
# grepping around, I see that /etc/runit/3 has:
#
# if [ -z "$VIRTUALIZATION" ]; then
# msg "Unmounting filesystems, disabling swap..."
# swapoff -a
# umount -r -a -t nosysfs,noproc,nodevtmpfs,notmpfs
# msg "Remounting rootfs read-only..."
# mount -o remount,ro /
# fi
# So it's probably the umount that failed? (but what is swapoff? swapon(8) says
# that `swapoff -a` disables all swap drives. _probably_ not what's at fault?)
# I added debugging to it to make sure that it's not the swapoff line. that
# umount line means "unmount everything that's not of type sysfs, proc,
# devtempfs, or tmpfs"
# ah ha! here's the issue: https://github.com/void-linux/void-runit/issues/16
# a quick read suggests that there's no easy way to work around it - it will
# get overwritten on system updates? have to hack around with it a bit.
# but there is a good workaround! It's to have a service that mounts your
# mounts when the network is available, and unmounts them when the system shuts
# down. It took a long time to find, and I wrote 2/3 of a replacement, but
# `netmount` does exactly that. I added the install and linking steps above.
# User Services
# --------
# It can be handy to run your own services. For example, I'm
# running one that checks for my keyboard being plugged in and enables a pot as
# volume control when it is.
#
# To do so, create a `llimllib-services` service directory in /etc/sv/, with a
# run file:
mkdir -p /etc/sv/llimllib-services && echo "
#!/bin/sh
exec 2>&1
exec chpst -ullimllib runsvdir /home/llimllib/service" > /etc/sv/llimllib-services/run \
&& chmod a+x /etc/sv/llimllib-services/run
# then create a `~/service` directory, and you can put user-controllable
# services in it by making a directory with a `run` script
#
# void docs: https://docs.voidlinux.org/config/services/user-services.html
# taking a screencast
# -------------
#
# I tried using `peek` to take a screencast, but it had terrible flickering and
# tearing. Lots of googling later, I learned that I might need to change my
# video acceleration method from the default "SNA", to the slower but
# functional "UXA". To figure out how to do _that_ was mostly a wild-assed
# guess that came down to:
echo "Section "Device"
Identifier "Intel Graphics"
Driver "intel"
Option "AccelMethod" "UXA"
EndSection" > /etc/X11/xorg.conf.d/20-intel.conf
# then restarting
# TODO:
# * I used the xbps-src method to install mdbook and mdbook-linkcheck, which
# clearly uses cargo; but cargo's not on my path. Where is it?
# * rn, dragging an icon in the start menu reliably crashes cinnamon
# * ctrl-alt-fn-f2 to get to a tty, then `sudo sv restart lxdm` to restart
# cinnamon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment