config.phundrak.com/README.org
2019-10-23 12:01:19 +02:00

904 lines
37 KiB
Org Mode
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#+TITLE: Phundraks dotfiles
#+AUTHOR: Lucien "Phundrak” Cartier-Tilet
#+EMAIL: phundrak@phundrak.fr
#+OPTIONS: H:4 broken_links:mark email:t ^:{} auto-id:t
# ### LaTeX ####################################################################
#+LATEX_CLASS: conlang
#+LaTeX_CLASS_OPTIONS: [a4paper,twoside]
#+LATEX_HEADER_EXTRA: \usepackage{tocloft} \setlength{\cftchapnumwidth}{3em}
#+LATEX_HEADER_EXTRA: \usepackage{xltxtra,fontspec,xunicode,svg}
#+LATEX_HEADER_EXTRA: \usepackage[total={17cm,24cm}]{geometry}
#+LATEX_HEADER_EXTRA: \setromanfont{Charis SIL}
#+LATEX_HEADER_EXTRA: \usepackage{xcolor}
#+LATEX_HEADER_EXTRA: \usepackage{hyperref}
#+LATEX_HEADER_EXTRA: \hypersetup{colorlinks=true,linkbordercolor=red,linkcolor=blue,pdfborderstyle={/S/U/W 1}}
#+LATEX_HEADER_EXTRA: \usepackage{multicol}
#+LATEX_HEADER_EXTRA: \usepackage{indentfirst}
#+LATEX_HEADER_EXTRA: \sloppy
# ### HTML #####################################################################
#+HTML_DOCTYPE: html5
#+HTML_HEAD_EXTRA: <meta name="description" content="Phundrak's dotfiles" />
#+HTML_HEAD_EXTRA: <meta property="og:title" content="Phundrak's dotfiles" />
#+HTML_HEAD_EXTRA: <meta property="og:description" content="Installation instructions for Phundrak's dotfiles" />
#+HTML_HEAD_EXTRA: <script src="https://kit.fontawesome.com/4d42d0c8c5.js"></script>
#+HTML_HEAD_EXTRA: <script src="https://cdn.jsdelivr.net/npm/js-cookie@2/src/js.cookie.min.js"></script>
#+HTML_HEAD_EXTRA: <link rel="shortcut icon" href="https://cdn.phundrak.fr/img/mahakala-128x128.png" type="img/png" media="screen" />
#+HTML_HEAD_EXTRA: <link rel="shortcut icon" href="https://cdn.phundrak.fr/img/favicon.ico" type="image/x-icon" media="screen" />
#+HTML_HEAD_EXTRA: <meta property="og:image" content="https://cdn.phundrak.fr/img/rich_preview.png" />
#+HTML_HEAD_EXTRA: <meta name="twitter:card" content="summary" />
#+HTML_HEAD_EXTRA: <meta name="twitter:site" content="@phundrak" />
#+HTML_HEAD_EXTRA: <meta name="twitter:creator" content="@phundrak" />
#+HTML_HEAD_EXTRA: <style>.org-svg{width:auto}</style>
#+INFOJS_OPT: view:info toc:1 home:https://phundrak.fr/ toc:t
#+HTML_HEAD_EXTRA: <link rel="stylesheet" href="https://langue.phundrak.fr/css/htmlize.min.css"/>
#+HTML_HEAD_EXTRA: <link rel="stylesheet" href="https://langue.phundrak.fr/css/main.css"/>
#+HTML_HEAD_EXTRA: <script src="https://langue.phundrak.fr/js/jquery.min.js"></script>
#+HTML_HEAD_EXTRA: <script defer src="https://langue.phundrak.fr/js/main.js"></script>
* Table of Contents :TOC_4_gh:noexport:
:PROPERTIES:
:CUSTOM_ID: h-400070eb-725f-4416-a4c6-da3053df750b
:END:
- [[#presentation][Presentation]]
- [[#screenshots][Screenshots]]
- [[#features][Features]]
- [[#email-signature][Email signature]]
- [[#global-gitignore][Global gitignore]]
- [[#rustfmt][Rustfmt]]
- [[#xresources][Xresources]]
- [[#dependencies][Dependencies]]
- [[#installation][Installation]]
- [[#install-arch-linux][Install Arch Linux]]
- [[#get-the-latest-live-system-with-fast-mirrors][Get the latest live system with fast mirrors]]
- [[#install-the-system][Install the system]]
- [[#install-basic-packages][Install basic packages]]
- [[#execute-bootstrap][Execute bootstrap]]
- [[#get-a-correct-keyboard-layout][Get a correct keyboard layout]]
- [[#set-our-locale][Set our locale]]
- [[#create-some-folders][Create some folders]]
- [[#set-users-shell-to-fish][Set users shell to fish]]
- [[#install-yay-if-it-isnt-already-installed][Install =yay= if it isnt already installed]]
- [[#setting-up-emacs-installing-spacemacs][Setting up Emacs: Installing Spacemacs]]
- [[#set-up-dotfiles][Set up dotfiles]]
- [[#update-our-dotfiles-remotes][Update our dotfiles remotes]]
- [[#get-envtpl][Get =envtpl=]]
- [[#update-our-submodules][Update our submodules]]
- [[#generate-our-alt-files][Generate our alt files]]
- [[#symlink-some-system-config-files][Symlink some system config files]]
- [[#install-basic-packages-1][Install basic packages]]
- [[#installing-tryones-compton-fork][Installing Tryones Compton fork]]
- [[#enable-some-of-our-services][Enable some of our services]]
- [[#docker][Docker]]
- [[#emacs][Emacs]]
- [[#ssh-server][SSH server]]
- [[#ly][Ly]]
- [[#set-up-our-fish-shell][Set up our fish shell]]
- [[#install-fisher][Install =fisher=]]
- [[#install-our-extensions][Install our extensions]]
- [[#install-packages-from-git][Install packages from git]]
- [[#i3-gaps-rounded][i3-gaps rounded]]
- [[#polybar-battery][Polybar Battery]]
- [[#revealjs][Reveal.JS]]
- [[#install-rust][Install Rust]]
- [[#install-the-toolchains][Install the toolchains]]
- [[#install-some-utilities][Install some utilities]]
- [[#clean-the-pacman-and-yay-cache][Clean the =pacman= and =yay= cache]]
- [[#licence][Licence]]
* Presentation
:PROPERTIES:
:CUSTOM_ID: h-536e69f5-c012-4b7d-8a45-3a340d3bc7ee
:END:
[[http://spacemacs.org][file:https://cdn.rawgit.com/syl20bnr/spacemacs/442d025779da2f62fc86c2082703697714db6514/assets/spacemacs-badge.svg]]
This is my collection of dotfiles for my daily GNU/Linux environment, tweaked
to my liking. If you wish to get the same setup as mine, follow the
instructions below.
As you can see, I personally use [[https://fishshell.com/][fish]] as my shell of choice, and [[https://www.gnu.org/software/emacs/][Emacs]] using
[[http://spacemacs.org][Spacemacs]] (still with Emacs keybinding) as my main text editor.
I also use [[https://github.com/resloved/i3][Resloved]]s [[https://github.com/resloved/i3][fork]] of [[https://github.com/Airblader/i3][i3-gaps]] with two [[https://github.com/jaagr/polybar][polybar]] bars and [[https://github.com/tryone144][Tryone144]]s
[[https://github.com/tryone144/compton][fork]] of [[https://github.com/chjj/compton][Compton]]. The colors scheme for [[https://github.com/davatorium/rofi][rofi]], Emacs and polybar are chosen from
the wallpapers using [[https://github.com/dylanaraps/pywal][pywal]].
* Screenshots
:PROPERTIES:
:CUSTOM_ID: h-ee37502b-09a4-4668-88e2-1d4406252bd2
:END:
#+ATTR_HTML: :width 100%
#+CAPTION: Desktop with Neofetch in the terminal
[[./img/neofetch.png]]
#+CAPTION: Desktop with Emacs opened
#+ATTR_HTML: :width 100%
[[./img/emacs.png]]
#+CAPTION: Desktop with Rofi
#+ATTR_HTML: :width 100%
[[./img/rofi.png]]
* Features
:PROPERTIES:
:CUSTOM_ID: h-8539dd6f-4fcb-4dc7-a3ef-b8ad198c91d4
:END:
- Emacs configuration perfectly tailored for my own use
- Beautiful and comfy i3 and polybar configuration
- And enough information below to get basically the same distro install as I
have on my main computer and my travel laptop.
Most of the org files you will find in this repos are the actual source code
of much of my config files. For instance, the [[#h-c13d132f-9e69-4bb0-838b-29c7c5611f11][Execute bootstrap]] subpart of
this file exports almost all of its code snippets to [[file:.yadm/bootstrap][.yadm/bootstrap]] thanks to =M-x org-babel-tangle= from within Emacs. Below I will also present and
comment some of my short config files which do not deserve to have a full org
file dedicated to them.
** Email signature
:PROPERTIES:
:CUSTOM_ID: h-f6c48286-a320-493f-b330-ee0a697e6d79
:HEADER-ARGS: :tangle ~/.signature
:END:
This file gets inserted automatically at the end of my emails.
#+BEGIN_SRC text
Lucien “Phundrak” Cartier-Tilet
https://phundrak.fr (Français)
https://en.phundrak.fr (English)
Pensez à notre planète, avez-vous vraiment besoin dimprimer ce courriel ?
Please mind our planet, do you really need to print this email?
#+END_SRC
** Global gitignore
:PROPERTIES:
:CUSTOM_ID: h-4f92eb29-7cfa-48ec-b39d-39037ace3682
:HEADER-ARGS: :tangle ~/.gitignore_global
:END:
Sometimes, there are some lines that always reappear in gitignores. So,
instead of always adding them, let git now that some elements are to be
ignored by default, hence the [[file:.gitignore_global][~/.gitignore_global]] file. First, we dont want
nanos backup files.
#+BEGIN_SRC text
~*
#+END_SRC
And output binaries generated by =gcc= and the likes arent welcome either.
#+BEGIN_SRC text
,*.out
#+END_SRC
** Rustfmt
:PROPERTIES:
:CUSTOM_ID: h-0ae9005c-76a6-49f6-947c-0c8464616e10
:HEADER-ARGS: :tangle ~/.rustfmt.toml
:END:
In my [[file:.rustfmt.toml][.rustfmt.toml]], you can find some custom rules on how my Rust code
should be formatted.
First, we are using the 2018 edition of Rust.
#+BEGIN_SRC toml
edition = "2018"
#+END_SRC
The maximum length of enum variant having discriminant, that gets vertically
aligned with others. Variants without discriminants would be ignored for the
purpose of alignment.
Note that this is not how much whitespace is inserted, but instead the
longest variant name that doesn't get ignored when aligning.
#+BEGIN_SRC toml
enum_discrim_align_threshold = 20
#+END_SRC
Put single-expression functions on a single line.
#+BEGIN_SRC toml
fn_single_line = true
#+END_SRC
Format code snippet included in doc comments.
#+BEGIN_SRC toml
format_code_in_doc_comments = true
#+END_SRC
Format string literals where necessary.
#+BEGIN_SRC toml
format_strings = true
#+END_SRC
Use tab characters for indentation, spaces for alignment.
#+BEGIN_SRC toml
hard_tabs = true
#+END_SRC
Maximum width of each line
#+BEGIN_SRC toml
max_width = 80
#+END_SRC
Merge multiple imports into a single nested import.
#+BEGIN_SRC toml
merge_imports = true
#+END_SRC
My newline style will always be Unix.
#+BEGIN_SRC toml
newline_style = Unix
#+END_SRC
Convert =/* */= comments to =//= comments where possible.
#+BEGIN_SRC toml
normalize_comments = true
#+END_SRC
Convert =#![doc]= and =#[doc]= attributes to =//!= and =///= doc comments.
#+BEGIN_SRC toml
normalize_doc_attributes = true
#+END_SRC
Reorder impl items. =type= and =const= are put first, then macros and
methods.
#+BEGIN_SRC toml
reorder_impl_items = true
#+END_SRC
Report =FIXME= items in comments.
#+BEGIN_SRC toml
report_fixme = "Always"
#+END_SRC
Report =TODO= items in comments.
#+BEGIN_SRC toml
todo = "Always"
#+END_SRC
The maximum diff of width between struct fields to be aligned with each
other.
#+BEGIN_SRC toml
struct_field_align_threshold = 20
#+END_SRC
Number of spaces per tab.
#+BEGIN_SRC toml
tab_spaces = 2
#+END_SRC
Break comments to fit on the line.
#+BEGIN_SRC toml
wrap_comments = true
#+END_SRC
** Xresources
:PROPERTIES:
:CUSTOM_ID: h-e6f48975-3b86-4a75-a7e5-5cc9edbd9869
:HEADER-ARGS: :tangle ~/.Xresources :exports code
:END:
My Xresources file is very short. Indeed, it only contains two lines which
are dedicated to my =st= terminal to set its font and shell. The font is set
as follows.
#+BEGIN_SRC conf
st.font: Source Code Pro for Powerline:style=book
#+END_SRC
And I will set my shell like this:
#+BEGIN_SRC conf
st.shell: /usr/bin/fish
#+END_SRC
I used to have lines dedicated to UXTerm and URxvt, but I cast them out of my
system.
* Dependencies
:PROPERTIES:
:CUSTOM_ID: h-5849dbcf-a650-4323-9a90-bec549a7b982
:END:
Of course, some dependencies are needed for my dotfiles to work well. Here is
a non-exhaustive list of software needed by these configuration files:
- [[https://www.gnu.org/software/emacs/][GNU/Emacs]] >= 26.2
- [[http://spacemacs.org][Spacemacs]] (develop branch)
- My [[https://labs.phundrak.fr/phundrak/conlang-layer][conlanging layer]]
- [[https://github.com/venmos/w3m-layer][Venmos]] [[https://github.com/venmos/w3m-layer][w3m layer]]
- The [[https://fishshell.com/][Fish shell]], using [[https://github.com/jorgebucaran/fisher][fisher]]
- [[https://lukesmith.xyz/][Luke Smith]]s [[https://github.com/LukeSmithxyz/st][fork]] of [[https://st.suckless.org/][st]]
- [[https://resloved.info/][Resloved]]s [[https://github.com/resloved/i3][i3-gaps-rounded]] fork of [[https://github.com/Airblader/i3][Airblader]]s [[https://github.com/Airblader/i3][i3-gaps]], itself a fork of [[https://i3wm.org/][i3]]
- [[https://github.com/yshui/compton][Compton]], more specificaly [[https://github.com/tryone144/compton][Tryone]]s [[https://github.com/tryone144/compton][fork]]
- [[https://github.com/dylanaraps/pywal/][pywal]]
- [[https://tools.suckless.org/dmenu/][dmenu]]
- [[https://github.com/enkore/j4-dmenu-desktop][j4-dmenu-desktop]]
- [[https://github.com/davatorium/rofi][Rofi]]
- [[https://github.com/gpoore/minted][minted]]
- [[https://www.rust-lang.org/][Rust]] (stable and nightly)
- [[https://www.latex-project.org/][LaTeX]] and [[http://xetex.sourceforge.net/][XeTeX]] (=texlive= packages on Arch Linux)
- [[https://github.com/tmux/tmux][tmux]], based on [[https://github.com/gpakosz/.tmux][this repo]]s configuration by [[https://pempek.net/][Grégory Pakosz]].
- And a bunch of other stuff, see below
And some other stuff scattered around in my dotfiles.
BTW, I use Arch.
* Installation
:PROPERTIES:
:CUSTOM_ID: h-bfb2e09b-d5d7-4d6f-8b29-763c49b3fd09
:END:
Here will be presented what I do to get my system up and running on a fresh
Arch Linux install. These installation instructions were written in order to
get an Arch Linux distribution up and running with the same configuration as
my main computers and my travelling laptops configuration.
** Install Arch Linux
:PROPERTIES:
:CUSTOM_ID: h-cfe21de6-15fa-477a-a5ff-6cd81dfead19
:END:
I usually install Arch from the [[https://www.archlinux.org/download/][vanilla ISO]], however I began using [[https://github.com/MatMoul/archfi][archfi]] to
install easily the distro (Ive done it so many times, I know how it works
now). Usually, my distros will be installed on at least two partitions, one
dedicated to =/home=, the other to the root partition =/=.
If the computer supports EFI bootloaders, the EFI partition will be mounted
on =/boot=. I generally use rEFInd as my boot manager, but if you are more
comfortable with another one, just install what you want. Be aware that if
you format your =/boot= partition, you will delete all boot managers that
already exist; so, if you are dual-booting, *DO NOT FORMAT IT*. Yes, I made
the mistake of wiping the Windows boot manager.
The swap partition is always at least 4GB large, and I should have a total of
12GB of combined RAM and swap. This means on my main computer I have 16GB of
RAM and 4GB of swap, but on my thinkpad I have 4GB of RAM and 8GB of swap.
*** Get the latest live system with fast mirrors
:PROPERTIES:
:CUSTOM_ID: h-da7951ee-e39a-4a59-a05d-7b7fffdc7825
:END:
When you boot into the live ISO, execute the following command:
#+BEGIN_SRC sh :exports code
pacman -Sy reflector
reflector --country France --country Germany --latest 200 \
--protocol http --protocol https --sort rate \
--save /etc/pacman.d/mirrorlist
#+END_SRC
This will update the packages from your live ISO, and you will get the best
mirrors for your installation. Of course, change the countries accordingly
to your location.
*** Install the system
:PROPERTIES:
:CUSTOM_ID: h-9f9e1fe5-4726-486b-9875-5fcfd91d0bb0
:END:
Then you can use a custom script to ease your installation of Arch if you do
not wish to do it manually. Personally, Ive done it several times already,
I know how the distro works, I just want to be able to install my distro
quickly now.
#+BEGIN_SRC sh :exports code
wget archfi.sf.net/archfi
# Or from matmoul.github.io/archfi if SourceForge is down
sh archfi
#+END_SRC
Then, follow the instructions and install Arch Linux. Take the opportunity
to install as many packages as you need, mainly =yay= which I use as my
package manager (it is just a wrapper for =pacman=) and AUR helper, and =pacman-contrib= which will help us installing some packages later.
Once your system is installed, reboot and remove your installation media
from your computer.
** Install basic packages
:PROPERTIES:
:CUSTOM_ID: h-d2485595-3014-4151-a76c-63bc353359a8
:END:
We will need some basic packages in order to run the bootstrap file. So,
lets install =fish= (our shell running the script) and =git=.
#+BEGIN_SRC sh :exports code
sudo pacman -Sy fish git yadm
#+END_SRC
** Execute bootstrap
:PROPERTIES:
:CUSTOM_ID: h-c13d132f-9e69-4bb0-838b-29c7c5611f11
:HEADER-ARGS: :tangle ~/.yadm/bootstrap :exports code
:END: =yadm= comes with a very handy feature: its bootstrap script. We can
execute it by running the following command:
#+BEGIN_SRC fish :tangle no
yadm bootstrap
#+END_SRC
Notice these two header files, we can see this is a fish script, hence why we
need fish (which is my daily shell anyway).
#+BEGIN_SRC fish
#!/usr/bin/fish
# -*- mode: fish -*-
#+END_SRC
Lets take a look at what it does.
*** Get a correct keyboard layout
:PROPERTIES:
:CUSTOM_ID: h-89fb8f3a-6ec4-4701-a5d9-3e593c47ece9
:END:
I use mainly the [[https://bepo.fr/wiki/Accueil][bépo]] layout, a French keyboard layout inspired by Dvorak
layouts, however I sometimes need to switch back to the standard French
AZERTY or the American QWERTY layout, so I make it so the Menu key switches
for me my layout between these three. This makes it so my xorg configuration
of my keyboard looks like this:
#+BEGIN_SRC fish
set keyboardconf \
'Section "InputClass"
Identifier "system-keyboard"
MatchIsKeyboard "on"
Option "XkbLayout" "fr,fr,us"
Option "XkbModel" "pc104"
Option "XkbVariant" "bepo,,"
Option "XkbOptions" "grp:menu_toggle"
EndSection'
#+END_SRC
So, lets set it as our keyboard configuration.
#+BEGIN_SRC fish
printf "\n# Set keyboard layout #########################################################\n\n"
echo $keyboardconf | sudo tee /etc/X11/xorg.conf.d/00-keyboard.conf
#+END_SRC
*** Set our locale
:PROPERTIES:
:CUSTOM_ID: h-48678405-93ae-41b6-b44b-285ab0da4e92
:END:
I use two main locales, the French and US UTF-8 locales, and I like to keep
the Japanese locale activated just in case.
#+BEGIN_SRC fish
set mylocales "en_US.UTF-8 UTF-8" "fr_FR.UTF-8 UTF-8" "ja_JP.UTF-8 UTF-8"
#+END_SRC
Lets enable these.
#+BEGIN_SRC fish
printf "\n# Set our locale ##############################################################\n\n"
for item in $mylocales
if test (grep -e "#$item" /etc/locale.gen)
sudo sed -i "/$item/s/^#//g" /etc/locale.gen
end
end
#+END_SRC
This is my configuration I usually use when it comes to my locale.
#+BEGIN_SRC fish
set localeconf "LANG=en_US.UTF-8
LC_COLLATE=C
LC_NAME=fr_FR.UTF-8
LC_NUMERIC=fr_FR.UTF-8
LC_IDENTIFICATION=fr_FR.UTF-8
LC_TELEPHONE=fr_FR.UTF-8
LC_MONETARY=fr_FR.UTF-8
LC_PAPER=fr_FR.UTF-8
LC_ADDRESS=fr_FR.UTF-8
LC_TIME=fr_FR.UTF-8
LC_MEASUREMENT=fr_FR.UTF-8"
#+END_SRC
Lets set it as our systems locale.
#+BEGIN_SRC fish
echo $localeconf | sudo tee /etc/locale.conf
#+END_SRC
Now we can generate our locale!
#+BEGIN_SRC fish
printf "\n# Generate locale #############################################################\n\n"
sudo locale-gen
#+END_SRC
*** Create some folders
:PROPERTIES:
:CUSTOM_ID: h-85ce90ff-56dc-469b-bf08-480ecf27acc4
:END:
Lets create some folders we might need for mounting our drives, Android
devices and CDs.
#+BEGIN_SRC fish
printf "\n# Create directories for mounting #############################################\n\n"
sudo mkdir -p /mnt/{USB,CD,Android}
sudo chown $USER:(id -g $USER) /mnt/{USB,CD,Android}
#+END_SRC
We also need the following folder for our nano backups.
#+BEGIN_SRC fish
mkdir -p $HOME/.cache/nano/backups
#+END_SRC
*** Set users shell to fish
:PROPERTIES:
:CUSTOM_ID: h-c1a78394-c156-4a03-ae82-e5e9d4090dab
:END:
First of all, the bootstrap shell will set the users shell to fish.
#+BEGIN_SRC fish
printf "\n# Set fish as the default shell ###############################################\n\n"
chsh -s /usr/bin/fish
#+END_SRC
*** Install =yay= if it isnt already installed
:PROPERTIES:
:CUSTOM_ID: h-fef57cea-cf1d-4900-9d90-ec6353ea9661
:END:
Now well need to be sure =yay=, our AUR helper, is installed on our system.
If it is, we dont need to to anything. However, if it isnt, well install
it manually.
#+BEGIN_SRC fish
if ! test which yay
printf "\n# Installing yay ##############################################################\n\n"
cd
mkdir -p fromGIT
cd fromGIT
git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -si --noconfirm
else
printf "\n# yay already installed #######################################################\n\n"
end
#+END_SRC
*** Setting up Emacs: Installing Spacemacs
:PROPERTIES:
:CUSTOM_ID: h-bd5a92c4-1a4f-49ea-a447-050a4ff0301c
:END:
Now, the first thing we want to do with Emacs is install its Spacemacs
distribution. Well clone its =develop= branch into =~/.emacs.d=. We need to
do this prior to our dotfiles cloning because of some submodules that are
cloned within our =~/.emacs.d= directory, and git wont let us clone
Spacemacs in an already existing and non-empty directory. To make sure it
isnt one, lets delete any potentially existing =~/.emacs.d= directory:
#+BEGIN_SRC fish
printf "\n# Installing Spacemacs ########################################################\n\n"
rm -rf ~/.emacs.d
#+END_SRC
Now we can clone Spacemacs:
#+BEGIN_SRC fish
git clone --single-branch --branch develop https://github.com/syl20bnr/spacemacs ~/.emacs.d
#+END_SRC
And we can restore what might have been deleted in our =~/.emacs.d/private=
directory:
#+BEGIN_SRC fish
yadm checkout -- ~/.emacs.d/private/
#+END_SRC
*** Set up dotfiles
:PROPERTIES:
:CUSTOM_ID: h-cf2c3a24-b08e-4b07-9d51-31f6df781e62
:END:
**** Update our dotfiles remotes
:PROPERTIES:
:CUSTOM_ID: h-18967335-2637-44d6-b407-bb1d2d2718b9
:END:
This line in the bootstrap script will test if the current user is using my
username. If yes, its probably me.
#+BEGIN_SRC fish
if ! test (echo "phundrak" | sed -e "s/^.*$USER//I")
#+END_SRC
If it is me installing and using these dotfiles, I want the remotes of my
dotfiles to be set to ssh remotes using my ssh keys.
#+BEGIN_SRC fish
printf "\n# Update yadms remotes #######################################################\n\n"
yadm remote set-url origin git@labs.phundrak.fr:phundrak/dotfiles.git
yadm remote add github git@github.com:phundrak/dotfiles.git
#+END_SRC
I will also want to decrypt my encrypted files, such as said ssh keys.
#+BEGIN_SRC fish
printf "\n# Decrypt encrypted dotfiles ##################################################\n\n"
yadm decrypt
#+END_SRC
Finally, lets close this =if= statement.
#+BEGIN_SRC fish
end
#+END_SRC
**** Get =envtpl=
:PROPERTIES:
:CUSTOM_ID: h-39034878-7864-4a1c-855d-d9882795aac0
:END:
Before we set our dotfiles up, lets make sure =envtpl= is correctly
installed. This package will be needed for generating our alt dotfiles.
#+BEGIN_SRC fish
printf '\n# Install envtpl ##############################################################\n\n'
yay -Syu python-envtpl-git
#+END_SRC
**** Update our submodules
:PROPERTIES:
:CUSTOM_ID: h-ae2f8ccb-a8f3-4699-832c-52cbc8b6d081
:END:
Now we can download the various dependencies of our dotfiles. To do so,
lets run the following command:
#+BEGIN_SRC fish
printf "\n# Getting yadm susbmodules ####################################################\n\n"
yadm submodule update --init --recursive
#+END_SRC
**** Generate our alt files
:PROPERTIES:
:CUSTOM_ID: h-f924c003-a15c-4132-891f-36cd3948a7c1
:END:
Now this should be the last manipulation on our dotfiles: lets create our
alternate files:
#+BEGIN_SRC fish
printf "\n# Generating alt files ########################################################\n\n"
yadm alt
#+END_SRC
**** Symlink some system config files
:PROPERTIES:
:CUSTOM_ID: h-b14d7d03-da49-4a7b-ba05-1c0848bd8e44
:END:
We have some files in [[file:ect/][etc/]] that are to be symlinked to =/etc=.
#+BEGIN_SRC fish
for f in (find ~/.etc -type f)
set dest (echo $f | sed -n 's/^.*etc\(.*\)$/\/etc\1/p')
sudo ln -s $f $dest
end
#+END_SRC
We may also want to symlink our [[file:.nanorc][nanorc]] to the =/root= directory for when we
use =nano= as =sudo=.
#+BEGIN_SRC fish
read --prompt "echo 'Symlink .nanorc to roots .nanorc? (Y/n): ' " -l nanoroot
if test $nanoroot = 'y' || test $nanoroot = "Y" || test $nanoroot = ''
printf "\n# Symlinking .nanorc to roots .nanorc ########################################\n\n"
sudo ln -s $HOME/.nanorc /root/.nanorc
end
#+END_SRC
*** Install basic packages
:PROPERTIES:
:CUSTOM_ID: h-887ec6d4-535d-4363-a0a7-884717b87a47
:END:
Lets set in a custom varible what packages well be needing.
#+BEGIN_SRC fish
set PACKAGES \
asar ascii aspell-en aspell-fr assimp awesome-terminal-fonts base-devel bat \
biber bleachbit bluez-firmware bluez-utils bookworm boost bzip2 chromium clisp \
clight compton cppcheck cppreference cppreference-devhelp cpupower cronie \
cryptsetup device-mapper diffutils discord-canary discount ditaa dmenu \
dmenu-lpass docker docker-compose doxygen dunst dwarffortress emacs \
exfat-utils ffmpegthumbnailer findutils firefox flake8 font-mathematica \
fontforge freeglut fzf gcc-libs gdb gimp glibc gnome-disk-utility \
gnome-epub-thumbnailer gnu-free-fonts gnuplot go-tools graphviz htop i3-gaps \
i3lock-blur i3status igdm-bin inetutils j4-dmenu-desktop jfsutils jmtpfs \
lastpass-cli less linux-headers lldb logrotate lvm2 ly-git meson minted mpc \
mpd mpd-rich-presence-discord-git mpv mupdf-tools nano ncdu ncmpcpp \
nemo-fileroller nemo-preview neofetch netctl networkmanager \
networkmanager-openvpn nm-connection-editor nnn nomacs noto-fonts-emoji npm \
ntfs-3g numlockx openssh p7zip pacman-contrib pandoc-bin pavucontrol pciutils \
pcurses pdfpc polybar pulseaudio-bluetooth python-envtpl-git python-pip \
python-pywal qemu r raw-thumbnailer reflector rofi rofi-wifi-menu-git rsync \
rtv rustup s-nail samba scrot sent shadow siji-git simplescreenrecorder \
speedcrunch sshfs st-luke-git swi-prolog texlive-bibtexextra texlive-bin \
texlive-core texlive-fontsextra texlive-formatsextra texlive-games \
texlive-humanities texlive-langchinese texlive-langcyrillic texlive-langextra \
texlive-langgreek texlive-langjapanese texlive-langkorean texlive-latexextra \
texlive-localmanager-git texlive-music texlive-pictures texlive-pstricks \
texlive-publishers texlive-science tmux tree ttf-arphic-uming ttf-baekmuk \
ttf-bitstream-vera ttf-dejavu ttf-google-fonts-opinionated-git ttf-joypixels \
ttf-liberation ttf-material-design-icons-git ttf-ms-fonts ttf-symbola \
ttf-tibetan-machine ttf-twemoji-color ttf-unifont unicode unicode-emoji unrar \
usbutils valgrind vim w3m wget x11-ssh-askpass xclip xdg-user-dirs-gtk \
xorg-drivers xorg-apps xfsprogs xorg-server xorg-xinit xss-lock yapf
#+END_SRC
These are the minimum I would have in my own installation. You can edit it
however you want. Lets install those.
#+BEGIN_SRC fish
printf "\n# Installing needed packages ##################################################\n\n"
yay -S --needed $PACKAGES
#+END_SRC
*** Installing Tryones Compton fork
:PROPERTIES:
:CUSTOM_ID: h-aecf9f01-268c-40cd-8fc3-622c6ce822e4
:END:
For some reason, I found installing directly this fork does not work, and I
need to install it after I installed the regular compton packages. =compton-tryone-git= will replace =compton= which will be removed.
#+BEGIN_SRC fish
printf "\n# Installing tryones compton fork ############################################\n\n"
yay -S compton-tryone-git
#+END_SRC
*** Enable some of our services
:PROPERTIES:
:CUSTOM_ID: h-1044da09-e992-4dcb-90ff-513725e1d450
:END:
We have installed some packages which require some services to run. Lets
enable them.
**** Docker
:PROPERTIES:
:CUSTOM_ID: h-429cb31a-fccb-420f-a5aa-21054c45fb38
:END:
First, lets activate Docker.
#+BEGIN_SRC fish
printf "\n# Enabling and starting Docker ################################################\n\n"
sudo systemctl enable --now docker
#+END_SRC
Now, if we wish it, we can be added to the =docker= group so we wont have
to type =sudo= each time we call Docker or Docker Compose.
#+BEGIN_SRC fish
read --prompt "echo 'Do you wish to be added to the `docker` group? (Y/n): ' " -l adddockergroup
if test $adddockergroup = 'y' || test $adddockergroup = "Y" || test $adddockergroup = ''
sudo usermod -aG docker $USER
end
#+END_SRC
**** Emacs
:PROPERTIES:
:CUSTOM_ID: h-7131fa13-3c6e-4cfc-b8e8-c880de9d380f
:END:
Emacs will run as a user service, which means it wont be launched until we
log in.
#+BEGIN_SRC fish
printf "\n# Enabling Emacs as user service ##############################################\n\n"
systemctl --user enable --now emacs
#+END_SRC
**** SSH server
:PROPERTIES:
:CUSTOM_ID: h-1f355779-f1dc-4c0f-9cf1-14724ce05f4d
:END:
Maybe we want to activate an SSH server on our machine. If so, we can
enable it. Lets ask the question.
#+BEGIN_SRC fish
read --prompt "echo 'Do you want to activate the ssh server? (Y/n): ' " -l sshdserver
if test $sshdserver = 'y' || test $sshdserver = "Y" || test $sshdserver = ''
printf "\n# Enabling ssh server #########################################################\n\n"
sudo systemctl enable --now sshd
end
#+END_SRC
**** Ly
:PROPERTIES:
:CUSTOM_ID: h-2785fc5b-cd35-4c99-9f47-3dcbf1a7a870
:END:
Ly is a display manager based on ncurses which I find nice enough for me to
use (I generally dont like using display managers). Lets enable it, and
lets disable tty2 while were at it (Ly uses it to run X).
#+BEGIN_SRC fish
sudo systemctl enable --now ly
sudo systemctl disable getty@tty2
#+END_SRC
*** Set up our fish shell
:PROPERTIES:
:CUSTOM_ID: h-f6f4df67-b0de-40bf-95fb-888d42169088
:END:
**** Install =fisher=
:PROPERTIES:
:CUSTOM_ID: h-d6490ddc-c909-4713-b36a-19c25a79c7ac
:END:
We will be using =fisher= as our extensions manager for Fish. Lets install
it.
#+BEGIN_SRC fish
printf "\n# Installing fisher ###########################################################\n\n"
curl https://git.io/fisher --create-dirs -sLo ~/.config/fish/functions/fisher.fish
#+END_SRC
**** Install our extensions
:PROPERTIES:
:CUSTOM_ID: h-3d540273-bdfb-4c63-a05f-2374a010dc29
:END:
I generally use the following extensions in my Fish shell.
#+BEGIN_SRC fish
set FISHEXTENSIONS \
edc/bass franciscolourenco/done jethrokuan/fzf jethrokuan/z \
jorgebucaran/fish-getopts laughedelic/pisces matchai/spacefish \
tuvistavie/fish-ssh-agent
#+END_SRC
Lets install these:
#+BEGIN_SRC fish
fisher add $FISHEXTENSIONS
#+END_SRC
*** Install packages from git
:PROPERTIES:
:CUSTOM_ID: h-e79da7b2-9286-4b66-812e-453e3b2505c7
:END:
Now, lets install some packages from git directly.
**** i3-gaps rounded
:PROPERTIES:
:CUSTOM_ID: h-10e229f7-9a45-4401-a9c0-3f974482bb9f
:END:
I know we already installed =i3-gaps= from the AUR, why reinstall it? Well,
that is certainly bad practices, but this allowed me to already have the
needed dependencies for building =i3= installed. Now, lets clone it, build
it, and install it. Doing this is probably very bad practices though, be
warned.
#+BEGIN_SRC fish
printf "\n# Install i3-gaps-rounded #####################################################\n\n"
cd ~/fromGIT
git clone https://github.com/resloved/i3.git i3-gaps-rounded
cd i3-gaps-rounded
rm -rf build
autoreconf --force --install
mkdir build && cd build
../configure --prefix=/usr --sysconfdir=/etc --disable-sanitizers
make -j
sudo make install
#+END_SRC
**** Polybar Battery
:PROPERTIES:
:CUSTOM_ID: h-f228ec52-a7d0-4c16-adfa-75c544fcfa93
:END:
Now lets install =polybar-battery=. This is a binary that Ill use in my
[[file:.config/i3/config][i3 config]] to indicate my battery level. It also sends a notification on low
battery and on charging completed.
#+BEGIN_SRC fish
printf "\n# Install polybar-battery #####################################################\n\n"
cd ~/fromGIT
git clone https://github.com/drdeimos/polybar_another_battery.git
cd polybar_another_battery
go get -u github.com/distatus/battery/cmd/battery
make build
#+END_SRC
Now, we have our binary, lets symlink it in our local binary directory, =~/.local/bin=.
#+BEGIN_SRC fish
ln -s polybar-ab ~/.local/bin/polybar-ab
#+END_SRC
**** Reveal.JS
:PROPERTIES:
:CUSTOM_ID: h-68d1cdb4-1447-420f-ab0c-53ef905e757b
:END:
I sometimes use Reveal.JS to make presentations, and I set its location in
my [[file:.spacemacs][dotspacemacs]] file to be in =~/fromGIT=, so lets clone it there.
#+BEGIN_SRC fish
printf "\n# Install Reveal.JS ###########################################################\n\n"
cd ~/fromGIT
git clone https://github.com/hakimel/reveal.js.git
#+END_SRC
*** Install Rust
:PROPERTIES:
:CUSTOM_ID: h-57e8af4c-93f2-4145-9c39-a5f8d1c9f012
:END:
**** Install the toolchains
:PROPERTIES:
:CUSTOM_ID: h-05ee25dc-3885-46ca-afaf-35bfb2e385d4
:END:
When using rust, I bounce between two toolchains, the =stable= toolchain
and the =nightly= toolchain. To install them, I will use =rustup= which has
already been installed.
#+BEGIN_SRC fish
printf "\n# Install the rust toolchains, nightly is the default one #####################\n\n"
rustup default nightly
#+END_SRC
This will both download the nightly toolchain and set it as the default
one. Yup, I like to live dangerously. Now to install the stable toolchain,
lets run this:
#+BEGIN_SRC fish
rustup toolchain install stable
#+END_SRC
**** Install some utilities
:PROPERTIES:
:CUSTOM_ID: h-f94f2e18-623f-4aa5-be99-6a7df6a9cbcd
:END:
Well need some utilities when developing Rust from Emacs, namely =rustfmt=
and =racer=. Lets install them with =cargo=.
#+BEGIN_SRC fish
printf "\n# Add rust utilities ##########################################################\n\n"
cargo install rustfmt racer
#+END_SRC
*** Clean the =pacman= and =yay= cache
:PROPERTIES:
:CUSTOM_ID: h-fa5307ec-065b-4d06-9d47-05ccde0da8ac
:END:
Finally, we are almost done! Lets clean the cache of =pacman= and =yay=.
#+BEGIN_SRC fish
printf "\n# Clean the pacman and yay cache ##############################################\n\n"
yay -Sc --noconfirm
#+END_SRC
You should now run a system pretty close to the one I have on my main
computer and my thinkpad.
* Licence
:PROPERTIES:
:CUSTOM_ID: h-a3438126-ee60-4f11-a2f6-f52e49dade59
:END:
All of my dotfiles (and my dotfiles only) are available under the GNU GPLv3
Licence. Please consult [[file:LICENCE.md]] for more information. In short: you
are free to access, edit and redistribute all of my dotfiles under the same
licence and as allowed by the licence, and if you fuck up something, its your
own responsibility.