Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/veracioux/dotfiles


https://github.com/veracioux/dotfiles

Last synced: about 23 hours ago
JSON representation

Awesome Lists containing this project

README

        

#+TITLE: Haris' Config
#+SETUPFILE: .setup.org

Welcome. This is my personal dotfile repository. I use Arch Linux, so these
dotfiles are customized to work there. I have also used a Macbook when
professionally required, so most of the configs will work there too, but expect
some incompatibilities and occasional breakage.

I do not directly keep my dotfiles in this repository. Rather, I write them as
literary documents with the actual configs embedded as code blocks. With the
help of Emacs and it's excellent =org-mode=, I can run a command and those code
blocks go exactly into the config file they need to. This approach is known as
literate programming.

I find it superior compared to keeping the config files directly because:
- It is much easier to document my configuration as it has become quite complex
and reading/writing it this way feels more natural.
- I can group related configuration from multiple programs in a single file, and
then export (/tangle/ is the technical term) them where they need to go. See for
example: [[file:shells.org][shells.org]].
- For each application, I can use the same org file to keep its configuration
and a script that installs all of its dependencies.
- I can use the breadth of =org-mode= features to more easily navigate my configs.
- It is very satisfying.
- I can put all the configs into a =~/.haris= folder and make that a regular git
repository, instead of keeping a bare repo in my home directory, which has
some drawbacks.

*NOTE:* The dotfiles are meant exclusively for Linux desktop. They have mostly
been created with an Arch Linux setup in mind, but most things should be
applicable to other distros as well (although I didn't specifically test this).

* Usage
I keep all persistent user configs in org files, and use =org-babel-tangle= (part
of Emacs) to tangle them, i.e. send all the configs to the files they need to be in
for the programs to read them.

If you are setting up these dotfiles for the first time, you can just run:
#+begin_src shell
curl https://veracioux.me/dotfiles/bootstrap.sh | bash
#+end_src

This will tangle all the dotfiles to where they need to go to be usable. You may
still need to [[*Installing dependencies][install dependencies]] to ensure you have all the programs the
dotfiles are meant to configure.

If you would like to do things in a more supervised manner, follow the
[[file:bootstrap/README.org][bootstrap]] instructions.

Once you have set everything up, any changes you make to the org-mode dotfiles
will need to be applied to the live configs by calling =haris/tangle-dest=. There
are also emacs key bindings for this, which you can inspect yourself. Note that
merely calling =org-babel-tangle= will just tangle the files to a temporary
location at =/tmp/tangle-$USER= (useful for inspecting changes before applying
them to your home directory).
* Installing dependencies
Most of my org-mode dotfiles have various *Dependencies* sections with code blocks
tangled to =/tmp/dependencies-$USER/...=, grouped by package manager that is
needed to install them. Those files contain a space/newline separated list of
package names, and the script *(WIP)* that installs the dependencies will parse
them as separate command-line arguments.

Here is a list of file extensions that can be used for dependency specifications
tangled to =/tmp/dependencies-$USER/=, including how each will *(soon)* be processed
by dependency installation scripts:

- =.pacman= :: Official Arch Linux packages, which will be installed with =sudo
pacman -S=
- =.aur= :: AUR packages, which will be installed with =paru -S=
- =.ubuntu= :: APT packages that should be installed on Ubuntu 22.04, using =sudo
apt install=. I might subdivide this for into multiple Ubuntu versions.
- =.pip= :: Python 3 packages, installed using =sudo pip install=.
- =.cpan= :: CPAN packages, installed using =sudo cpan=.
- =.pip-user= :: Python 3 packages, installed using =pip install= for the current
user only.
- Any other extension or none :: Custom dependency installation script. It will
be executed directly.

This list might be extended in the future, but I will try my best to keep it up
to date as a centralized overview of all the subdirectories I use.

*NOTE:* I made most of the dependency lists while using *Arch Linux*, so you should
expect the best completeness when using =pacman= as the package manager and =paru=
as an AUR helper.

*NOTE:* I have recently started seriously using a Ubuntu setup as well, making
changes to my configs whenever I noticed that something didn't work. Some things
were caused by differing packages among distributions, and I solved them by
installing the missing dependencies, but I haven't always been meticulous in
updating my dotfiles correspondingly.

** TODO System setup script
:PROPERTIES:
:header-args+: :tangle (haris/tangle-deps "global-dependencies.sh") :tangle-mode (identity #o744)
:END:
This is a shell script for installing general system dependencies that I created
some time ago. It is quite incomplete, but can be useful to save some work when
initializing a new setup meant to use my dotfiles, from scratch.
#+begin_src shell
#!/usr/bin/env bash

official() {
pacman -S "$@"
}

unofficial() {
paru -S "$@"
}

npm() {
command npm install -g "$@"
}

# Keyboard setup step, don't need it with this laptop.
ip link
echo "Setup your wifi network using iwctl."
iwctl
echo -e '[Network]\nEnableIPv6=true' >> /etc/iwd/main.conf
ping archlinux.org # verify connection
timedatectl set-ntp true
echo 'Now run cfdisk /dev/'
# TODO
mount 'system_partition' /mnt
mount '/dev/' /mnt/boot
pacstrap /mnt base linux linux-firmware vim doas iwd man mandb sudo curl

pacman -Sy

genfstab -L /mnt >> /mnt/etc/fstab

arch-chroot /mnt

# Context-specific
ln -sf /usr/share/zoneinfo/Europe/Sarajevo /etc/localtime

hwclock --systohc

echo 'en_US.UTF-8 UTF-8' >> /etc/locale.gen
locale-gen
echo 'LANG=en_US.UTF-8' >> /etc/locale.conf
# TODO set the console keyboard layout

echo 'haris-gusic' > /etc/hostname
# maybe run 'mkinitcpio -P'

pacman -Sy

official grub efibootmgr

# Swapfile

exit # TODO FIXME

# Essential
official base-devel git dash doas fish neovim

# Create user
for group in uucp video davfs2 fuse tty docker; do
groupadd "$group"
done
useradd -m -G log,lock,wheel,tty,audio,lp,uucp,video,davfs2,fuse -s /usr/bin/dash haris

# TODO After first login
git clone 'https://github.com/Morganamilo/paru' /tmp/paru

# A list of packages to install on a fresh system install

# System stuff
official pacman-contrib etckeeper
# Network
official networkmanager iw wpa_suplicant proton
official bluez bluez-libs bluez-tools bluez-utils
# Low-level
official xorg-server xorg-server-common xf86-video-vesa xorg-setxkbmap \
xorg-xev xorg-xmodmap xorg-xprop xorg-xrandr xorg-xrdb xorg-xset \
xorg-xsetroot xorg-xinit
official acpilight qtile i3-gaps picom xbindkeys sxhkd

# Editors and viewers
official lsd xarchiver ueberzug imagemagick python-sphinx emacs
official vifm ueberzug ffmpegthumbnailer ranger nemo gsettings
official zathura zathura-pdf-mupdf
official gimp inkscape poppler xournalpp

# Programming
official python python-pip python-sphinx

# Utilities
official xsel xclip moreutils rsync findutils dialog fzf clipmenu entr gnu-netcat cronie
official xss-lock pass
official flameshot zbar
official neomutt translate-shell transmission-cli
official speedcrunch
unofficial urlview buku-git asciinema dragon-drag-and-drop
unofficial git-extras
official ascii

# Plugins
official fisher firefox-tridactyl

# Resources
official adobe-source-code-pro-fonts ttf-lato ttf-font-awesome
unofficial dracula-gtk-theme ttf-spacemono

## Dependencies
~/.vim/.dependencies.sh
~/.mozilla/firefox/pacman.sh

# Fix wifi dropping issue
echo -e '[connection]\nwifi.powersave = 2' > \
/etc/NetworkManager/conf.d/default-wifi-powersave-on.conf
#+end_src
* Default applications
:PROPERTIES:
:header-args:conf+: :tangle (haris/tangle-home ".config/mimeapps.list")
:END:
Here you can find a mapping of mime types to default applications that I use,
and some added mime type associations. To apply the changes, run:
#+begin_src shell
update-desktop-database ~/.local/share/applications
#+end_src
** Default applications
#+begin_src conf :tangle (haris/tangle-home ".config/mimeapps.list")
[Default Applications]
application/octet-stream=emacs.desktop;gvim.desktop;
application/pdf=sioyek.desktop;org.pwmt.zathura-pdf-mupdf.desktop;
application/x-dxf=librecad.desktop;
application/x-gnome-saved-search=nemo.desktop;
inode/directory=alacritty-open.desktop;
image/jpeg=vimiv.desktop;sxiv.desktop;
image/png=vimiv.desktop;sxiv.desktop;
image/svg+xml=vimiv.desktop;sxiv.desktop;
image/tiff=vimiv.desktop;sxiv.desktop;
image/vnd.dwg=inkscape.desktop;
image/vnd.dxf=org.inkscape.Inkscape.desktop;
image/webp=vimiv.desktop;sxiv.desktop;
text/doc=libreoffice-writer.desktop;
text/html=firefox.desktop;
text/plain=emacs.desktop;gvim.desktop;
text/x-arduino=arduino-arduinoide.desktop;
text/x-bibtex=emacs.desktop;gvim.desktop;
text/x-c=emacs.desktop;gvim.desktop;
text/x-c++=emacs.desktop;gvim.desktop;org.qt-project.qtcreator.desktop;
text/x-chdr=emacs.desktop;gvim.desktop;
text/x-c++hdr=emacs.desktop;gvim.desktop;org.qt-project.qtcreator.desktop;
text/x-csrc=emacs.desktop;gvim.desktop;
text/x-c++src=emacs.desktop;gvim.desktop;org.qt-project.qtcreator.desktop;
text/xml=emacs.desktop;gvim.desktop;firefox.desktop;
text/x-org=emacs.desktop;
text/x-script.python=emacs.desktop;gvim.desktop;
text/x-shellscript=emacs.desktop;gvim.desktop;
text/x-tex=emacs.desktop;gvim.desktop;
video/mp4=mpv.desktop;
video/mpeg=mpv.desktop;
video/webm=mpv.desktop;
video/x-matroska=mpv.desktop;
x-directory/gnome-default-handler=nemo.desktop;
x-directory/normal=nemo.desktop;
x-scheme-handler/file=nemo.desktop;
x-scheme-handler/http=firefox.desktop;
x-scheme-handler/https=firefox.desktop;
x-scheme-handler/msteams=teams.desktop;
x-scheme-handler/tg=org.telegram.desktop.desktop;
x-scheme-handler/viber=viber.desktop;
#+end_src
** Added associations
#+begin_src conf :tangle (haris/tangle-home ".config/mimeapps.list")
[Added Associations]
application/octet-stream=gvim.desktop;
application/x-bibtex=gvim.desktop;
image/vnd.dwg=inkscape.desktop;org.inkscape.Inkscape.desktop;
image/vnd.dxf=inkscape.desktop;org.inkscape.Inkscape.desktop;
#+end_src
* TODO Common keybindings
* Global variables
** =HARIS​_BACKGROUND​_TASKS​_SILENT=
I have configured my main shell fish to notify me when non-visible background
tasks finish. Setting this variable to a non-zero value disables this behavior.
** =TERM=
This variable is hardly invented by me. But I use it heavily in scripts, most
notably the =TERM=dumb= value. In general, if =TERM=dumb=, that is a hint to my
scripts and utilities that graphical interaction is preferred over terminal
interaction. The [[file:scripts.org::*=askpass=][askpass]] command behaves this way for example.