better settings for tangling the code blocks

This commit is contained in:
Phuntsok Drak-pa 2019-10-21 12:13:40 +02:00
parent 8ff8b6c6c6
commit a14d538aa2
3 changed files with 92 additions and 87 deletions

View File

@ -76,6 +76,7 @@
* Presentation
:PROPERTIES:
:CUSTOM_ID: h-c2560b46-7f97-472f-b898-5ab483832228
:HEADER-ARGS: :tangle yes
:END:
The file present in =~/.config/fish/config.fish= is the configuration file for
the [[https://fishshell.com/][fish shell]]. It contains custom functions, environment variables and
@ -83,7 +84,7 @@
Just in case, we might need sometimes to declare the fish function
=fish_title= as =true=, so lets do so.
#+BEGIN_SRC fish :tangle yes
#+BEGIN_SRC fish
function fish_title
true
end
@ -95,7 +96,7 @@
:END:
I sometimes call fish from within emacs, with =M-x ansi-term=. In this case,
the variable =TERM= needs to have the value =eterm-color=.
#+BEGIN_SRC fish :tangle yes
#+BEGIN_SRC fish
if test -n "$EMACS"
set -x TERM eterm-color
end
@ -110,7 +111,7 @@
the commands it needs to execute, and nothing else. Due to this, lets
deactivate and redefine some of the functions defining the appearance of
fish.
#+BEGIN_SRC fish :tangle yes
#+BEGIN_SRC fish
if test "$TERM" = "dumb"
function fish_prompt
echo "\$ "
@ -128,7 +129,7 @@
Now, there is only one function I modify when it comes to the appearance of
fish when Im the one using it: I simply “delete” the =fish_greeting=
function.
#+BEGIN_SRC fish :tangle yes
#+BEGIN_SRC fish
function fish_greeting; end
#+END_SRC
@ -140,26 +141,26 @@
is for example the case with my =PATH= variable in which I add Rusts Cargos
binaries, Gos binaries and my own executables. And of course, dont forget
to add the already existing =PATH=.
#+BEGIN_SRC fish :tangle yes
#+BEGIN_SRC fish
set -gx PATH $HOME/.local/bin $HOME/go/bin $HOME/.cargo/bin $PATH
#+END_SRC
Sometimes, software will rely on =SUDO_ASKPASS= to get a GUI from which it
can get the sudo password. So, lets declare it.
#+BEGIN_SRC fish :tangle yes
#+BEGIN_SRC fish
set -gx SUDO_ASKPASS ~/.local/bin/askpass
#+END_SRC
Now, lets declare our editor of choice, EmacsClient. Now, we want it to run
in the terminal, since it will most often be just quick edits, nothing too
heavy, if it is called from the =EDITOR= variable (from Git, for example).
#+BEGIN_SRC fish :tangle yes
#+BEGIN_SRC fish
set -gx EDITOR emacsclient -c -nw
#+END_SRC
Finally, some development packages require the =PKG_CONFIG_PATH= to be set,
so lets do so.
#+BEGIN_SRC fish :tangle yes
#+BEGIN_SRC fish
set -gx PKG_CONFIG_PATH /usr/local/lib/pkgconfig/ $PKG_CONFIG_PATH
#+END_SRC
@ -174,31 +175,31 @@
Here I have some abbreviations which are quite useful when performing some
system monitoring. With =df=, we can get an overview of our filesystem
usage, while with =diskspace= we get some more precise information.
#+BEGIN_SRC fish :tangle yes
#+BEGIN_SRC fish
abbr df 'df -H'
abbr diskspace 'sudo df -h | grep -E "sd|lv|Size"'
#+END_SRC
=meminfo= is a call to =free= with sane defaults.
#+BEGIN_SRC fish :tangle yes
#+BEGIN_SRC fish
abbr meminfo 'free -m -l -t'
#+END_SRC
Similar to =meminfo=, we also have =gpumeminfo= so we can get a quick look
at the memory-related logs of our X session.
#+BEGIN_SRC fish :tangle yes
#+BEGIN_SRC fish
abbr gpumeminfo 'grep -i --color memory /var/log/Xorg.0.log'
#+END_SRC
I also declared =cpuinfo= an alias of =lscpu= in order to keep consistent
with =meminfo=.
#+BEGIN_SRC fish :tangle yes
#+BEGIN_SRC fish
abbr cpuinfo lscpu
#+END_SRC
=pscpu= gives us information on what the CPU is running right now, and
=pscpu10= limits that to the top 10 threads.
#+BEGIN_SRC fish :tangle yes
#+BEGIN_SRC fish
abbr pscpu 'ps auxf | sort -nr -k 3'
abbr pscpu10 'ps auxf | sort -nr -k 3 | head -10'
#+END_SRC
@ -206,7 +207,7 @@
Similarly, =psmem= gives us information on the memory usage of the current
threads, and =psmem10= only the ten most important threads in terms of
memory usage.
#+BEGIN_SRC fish :tangle yes
#+BEGIN_SRC fish
abbr psmem 'ps auxf | sort -nr -k 4'
abbr psmem10 'ps auxf | sort -nr -k 4 | head -10'
#+END_SRC
@ -224,36 +225,36 @@
:END:
The first command is =remove= which removes a package from my system, as
well as its dependencies no longer needed.
#+BEGIN_SRC fish :tangle yes
#+BEGIN_SRC fish
abbr remove 'sudo pacman -Rscnd'
#+END_SRC
And if I want to install something, I just have to type =install=.
#+BEGIN_SRC fish :tangle yes
#+BEGIN_SRC fish
abbr install 'sudo pacman -Sy'
#+END_SRC
But if I just want to run =pacman= as sudo, then I could always just type
=p=.
#+BEGIN_SRC fish :tangle yes
#+BEGIN_SRC fish
abbr p 'sudo -A pacman'
#+END_SRC
Sometimes, I just want to purge my package managers cache, be it
=pacman='s or =yay='s. This is why I simply type =purge=.
#+BEGIN_SRC fish :tangle yes
#+BEGIN_SRC fish
abbr purge 'yay -Sc'
#+END_SRC
And if I want to simply seach among the =pacman= repos, I can type
=search=. Otherwise, if I want to include AUR results, Ill use =yay=.
#+BEGIN_SRC fish :tangle yes
#+BEGIN_SRC fish
abbr search 'pacman -Ss'
#+END_SRC
To update everything from the official repos, Ill sometimes type =update=
instead of the full command.
#+BEGIN_SRC fish :tangle yes
#+BEGIN_SRC fish
abbr update 'sudo pacman -Syu'
#+END_SRC
@ -263,13 +264,13 @@
:END:
I dont have the muscle memory of =systemctl=. So instead, I simply type
=c= when I want to do something user service related.
#+BEGIN_SRC fish :tangle yes
#+BEGIN_SRC fish
abbr s 'systemctl --user'
#+END_SRC
And if I want to manipulate system services, I can instead type a simple
capital =S=.
#+BEGIN_SRC fish :tangle yes
#+BEGIN_SRC fish
abbr S 'sudo systemctl'
#+END_SRC
@ -286,7 +287,7 @@
:END:
I have the following abbreviations so I can quickly run CMake and create a
configuration for debug or release profiles.
#+BEGIN_SRC fish :tangle yes
#+BEGIN_SRC fish
abbr cdebug 'cmake -DCMAKE_BUILD_TYPE=Debug'
abbr crelease 'cmake -DCMAKE_BUILD_TYPE=Release'
#+END_SRC
@ -310,7 +311,7 @@
:END:
And of course, when it comes to Docker Compose, I dont have time to write
the full command, so I use these instead.
#+BEGIN_SRC fish :tangle yes
#+BEGIN_SRC fish
abbr dc docker-compose
abbr dcd 'docker-compose down'
abbr dcr 'docker-compose run --rm'
@ -335,7 +336,7 @@
:END:
When I launch =swipl=, I prefer to have my terminal cleaned before and
after it runs, I find it more clean.
#+BEGIN_SRC fish :tangle yes
#+BEGIN_SRC fish
abbr swipl 'clear && swipl -q && clear'
#+END_SRC
@ -346,19 +347,19 @@
I greatly prefer to use Emacsclient as my main text editor; Emacs has
basically all I need. So, its only normal I have an abbreviation to launch
a new instance of it.
#+BEGIN_SRC fish :tangle yes
#+BEGIN_SRC fish
abbr e 'emacsclient -c'
#+END_SRC
However, in a graphical environment, this will launch a new graphical
window of Emacs. To launch a terminal instance, Ill use =enw= (=nw= stands
for the option “nowindow” =-nw= of Emacs).
#+BEGIN_SRC fish :tangle yes
#+BEGIN_SRC fish
abbr enw 'emacsclient -c -nw'
#+END_SRC
I also have the abbreviation =vi= which refers to =vim=. I really should
learn =vi=, but I also really dont feel like it.
#+BEGIN_SRC fish :tangle yes
#+BEGIN_SRC fish
abbr vi vim
#+END_SRC
@ -371,11 +372,11 @@
package manager. It is recommended to use =tllocalmgr= instead of =tlmgr=,
but I can never remember the command, and the latter is faster to type, so
time for an abbreviation.
#+BEGIN_SRC fish :tangle yes
#+BEGIN_SRC fish
abbr tlmgr tllocalmgr
#+END_SRC
#+BEGIN_SRC fish :tangle yes
#+BEGIN_SRC fish
abbr texhash 'sudo texhash'
#+END_SRC
@ -386,7 +387,7 @@
Some commands can be quite dangerous when not used properly, which is why I
added default flags and options so I can get warnings before things get
ugly.
#+BEGIN_SRC fish :tangle yes
#+BEGIN_SRC fish
abbr cp 'cp -i'
abbr ln 'ln -i'
abbr lns 'ln -si'
@ -402,7 +403,7 @@
delition of a directory. Notice also the =--preserve-root= which will
prevent me from accidentally removing the root folder. I added the same
option to =chgrp=, =chmod=, and =chown=.
#+BEGIN_SRC fish :tangle yes
#+BEGIN_SRC fish
abbr chgrp 'chgrp --preserve-root'
abbr chmod 'chmod --preserve-root'
abbr chown 'chown --preserve-root'
@ -419,18 +420,18 @@
Sometimes for some reasons, my brain makes me write =clean= instead of
=clear=. So, lets just replace the former by the latter.
#+BEGIN_SRC fish :tangle yes
#+BEGIN_SRC fish
abbr clean clear
#+END_SRC
Im also very bad at typing =exit=.
#+BEGIN_SRC fish :tangle yes
#+BEGIN_SRC fish
abbr exi exit
abbr exti exit
#+END_SRC
And sometimes I suck at typing =htop=.
#+BEGIN_SRC fish :tangle yes
#+BEGIN_SRC fish
abbr hotp htop
#+END_SRC
@ -449,7 +450,7 @@
my custom graphical script for getting my password (see
[[file:~/.local/bin/askpass][.local/bin/askpass]]). I also made it so =please= is an equivalent to =sudo
-A= as a joke.
#+BEGIN_SRC fish :tangle yes
#+BEGIN_SRC fish
abbr sudo 'sudo -A'
abbr please 'sudo -A'
#+END_SRC
@ -459,7 +460,7 @@
:CUSTOM_ID: h-8cf0e895-b919-41a8-ad3d-c5294dc507fd
:END:
Sometimes I find it easier to just type =q= instead of =exit=.
#+BEGIN_SRC fish :tangle yes
#+BEGIN_SRC fish
abbr q exit
#+END_SRC
@ -469,7 +470,7 @@
:END:
I also find it more intuitive and faster to just write =hist= instead of
=history=, so lets declare that.
#+BEGIN_SRC fish :tangle yes
#+BEGIN_SRC fish
abbr hist history
#+END_SRC
@ -479,7 +480,7 @@
:END:
When I want to download a song from YouTube, Ill just use the command
=flac videoIdentifier= to get it through =youtube-dl=.
#+BEGIN_SRC fish :tangle yes
#+BEGIN_SRC fish
abbr flac 'youtube-dl -x --audio-format flac --audio-quality 0'
#+END_SRC
@ -490,7 +491,7 @@
When it comes to mpv, I do not want to force it to open a graphical window
if for example I want to listen to an audio file. I also do not want any
border on that window. So, I declared this abbreviation.
#+BEGIN_SRC fish :tangle yes
#+BEGIN_SRC fish
abbr mpv 'mpv --no-border --force-window=no'
#+END_SRC
@ -503,7 +504,7 @@
one day hopefully, after seeing the abbreviations expansion over and over
Ill remember the command like I did for the abbreviation of =remove= (see
[[#h-281a59aa-4ea0-47ab-a4cc-33fff8d38165][Package management]]).
#+BEGIN_SRC fish :tangle yes
#+BEGIN_SRC fish
abbr compress 'tar -czf'
abbr untar 'tar -xvzf'
#+END_SRC
@ -515,7 +516,7 @@
Some sane default options for =feh=, including auto-zoom to fit the picture
to the window, a borderless window, and again scale the image to fit the
window geometry.
#+BEGIN_SRC fish :tangle yes
#+BEGIN_SRC fish
abbr feh 'feh -Zx.'
#+END_SRC
@ -525,7 +526,7 @@
:END:
Yep, an abbreviation of =ls= called =lsl=. It allows me to view all the
files in a directory as a list with detailed, human-readable information.
#+BEGIN_SRC fish :tangle yes
#+BEGIN_SRC fish
abbr lsl 'ls -ahl'
#+END_SRC
@ -535,7 +536,7 @@
:END:
This is just =nmcli= with sane default options, that is a pretty output
with colors.
#+BEGIN_SRC fish :tangle yes
#+BEGIN_SRC fish
abbr nmcli 'nmcli -p -c auto'
#+END_SRC
@ -544,6 +545,6 @@
:CUSTOM_ID: h-74f84f1c-433d-488a-88a7-89915c1a3bd5
:END:
By default, continue a download that was interupted.
#+BEGIN_SRC fish :tangle yes
#+BEGIN_SRC fish
abbr wget 'wget -c'
#+END_SRC

View File

@ -150,6 +150,9 @@ if test $sshdserver = 'y' || test $sshdserver = "Y" || test $sshdserver = ''
sudo systemctl enable --now sshd
end
sudo systemctl enable --now ly
sudo systemctl disable getty@tty2
printf "\n# Installing fisher ###########################################################\n\n"
curl https://git.io/fisher --create-dirs -sLo ~/.config/fish/functions/fisher.fish

View File

@ -231,6 +231,7 @@
** Execute bootstrap
:PROPERTIES:
:CUSTOM_ID: h-c13d132f-9e69-4bb0-838b-29c7c5611f11
:HEADER-ARGS: :tangle ~/.yadm/bootstrap
:END:
=yadm= comes with a very handy feature: its bootstrap script. We can
execute it by running the following command:
@ -240,7 +241,7 @@
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 :exports code :tangle ~/.yadm/bootstrap
#+BEGIN_SRC fish :exports code
#!/usr/bin/fish
# -*- mode: fish -*-
#+END_SRC
@ -255,7 +256,7 @@
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 :exports code :tangle ~/.yadm/bootstrap
#+BEGIN_SRC fish :exports code
set keyboardconf \
'Section "InputClass"
Identifier "system-keyboard"
@ -267,7 +268,7 @@
EndSection'
#+END_SRC
So, lets set it as our keyboard configuration.
#+BEGIN_SRC fish :exports code :tangle ~/.yadm/bootstrap
#+BEGIN_SRC fish :exports code
printf "\n# Set keyboard layout #########################################################\n\n"
echo $keyboardconf | sudo tee /etc/X11/xorg.conf.d/00-keyboard.conf
#+END_SRC
@ -278,11 +279,11 @@
: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 :exports code :tangle ~/.yadm/bootstrap
#+BEGIN_SRC fish :exports code
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 :exports code :tangle ~/.yadm/bootstrap
#+BEGIN_SRC fish :exports code
printf "\n# Set our locale ##############################################################\n\n"
for item in $mylocales
if test (grep -e "#$item" /etc/locale.gen)
@ -292,7 +293,7 @@
#+END_SRC
This is my configuration I usually use when it comes to my locale.
#+BEGIN_SRC fish :exports code :tangle ~/.yadm/bootstrap
#+BEGIN_SRC fish :exports code
set localeconf "LANG=en_US.UTF-8
LC_COLLATE=C
LC_NAME=fr_FR.UTF-8
@ -306,11 +307,11 @@
LC_MEASUREMENT=fr_FR.UTF-8"
#+END_SRC
Lets set it as our systems locale.
#+BEGIN_SRC fish :exports code :tangle ~/.yadm/bootstrap
#+BEGIN_SRC fish :exports code
echo $localeconf | sudo tee /etc/locale.conf
#+END_SRC
Now we can generate our locale!
#+BEGIN_SRC fish :exports code :tangle ~/.yadm/bootstrap
#+BEGIN_SRC fish :exports code
printf "\n# Generate locale #############################################################\n\n"
sudo locale-gen
#+END_SRC
@ -321,7 +322,7 @@
:END:
Lets create some folders we might need for mounting our drives, Android
devices and CDs.
#+BEGIN_SRC fish :exports code :tangle ~/.yadm/bootstrap
#+BEGIN_SRC fish :exports code
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}
@ -332,7 +333,7 @@
: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 :exports code :tangle ~/.yadm/bootstrap
#+BEGIN_SRC fish :exports code
printf "\n# Set fish as the default shell ###############################################\n\n"
chsh -s /usr/bin/fish
#+END_SRC
@ -344,7 +345,7 @@
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 :exports code :tangle ~/.yadm/bootstrap
#+BEGIN_SRC fish :exports code
if ! test which yay
printf "\n# Installing yay ##############################################################\n\n"
cd
@ -368,17 +369,17 @@
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 :exports code :tangle ~/.yadm/bootstrap
#+BEGIN_SRC fish :exports code
printf "\n# Installing Spacemacs ########################################################\n\n"
rm -rf ~/.emacs.d
#+END_SRC
Now we can clone Spacemacs:
#+BEGIN_SRC fish :exports code :tangle ~/.yadm/bootstrap
#+BEGIN_SRC fish :exports code
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 :exports code :tangle ~/.yadm/bootstrap
#+BEGIN_SRC fish :exports code
yadm checkout -- ~/.emacs.d/private/
#+END_SRC
@ -392,23 +393,23 @@
: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 :exports code :tangle ~/.yadm/bootstrap
#+BEGIN_SRC fish :exports code
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 :exports code :tangle ~/.yadm/bootstrap
#+BEGIN_SRC fish :exports code
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 :exports code :tangle ~/.yadm/bootstrap
#+BEGIN_SRC fish :exports code
printf "\n# Decrypt encrypted dotfiles ##################################################\n\n"
yadm decrypt
#+END_SRC
Finally, lets close this =if= statement.
#+BEGIN_SRC fish :exports code :tangle ~/.yadm/bootstrap
#+BEGIN_SRC fish :exports code
end
#+END_SRC
@ -418,7 +419,7 @@
: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 :exports code :tangle ~/.yadm/bootstrap
#+BEGIN_SRC fish :exports code
printf '\n# Install envtpl ##############################################################\n\n'
yay -Syu python-envtpl-git
#+END_SRC
@ -429,7 +430,7 @@
:END:
Now we can download the various dependencies of our dotfiles. To do so,
lets run the following command:
#+BEGIN_SRC fish :exports code :tangle ~/.yadm/bootstrap
#+BEGIN_SRC fish :exports code
printf "\n# Getting yadm susbmodules ####################################################\n\n"
yadm submodule update --init --recursive
#+END_SRC
@ -440,7 +441,7 @@
:END:
Now this should be the last manipulation on our dotfiles: lets create our
alternate files:
#+BEGIN_SRC fish :exports code :tangle ~/.yadm/bootstrap
#+BEGIN_SRC fish :exports code
printf "\n# Generating alt files ########################################################\n\n"
yadm alt
#+END_SRC
@ -450,7 +451,7 @@
: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 :exports code :tangle ~/.yadm/bootstrap
#+BEGIN_SRC fish :exports code
for f in (find ~/.etc -type f)
set dest (echo $f | sed -n 's/^.*etc\(.*\)$/\/etc\1/p')
sudo ln -s $f $dest
@ -459,7 +460,7 @@
We may also want to symlink our [[file:.nanorc][nanorc]] to the =/root= directory for when we
use =nano= as =sudo=.
#+BEGIN_SRC fish :exports code :tangle ~/.yadm/bootstrap
#+BEGIN_SRC fish :exports code
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"
@ -472,7 +473,7 @@
:CUSTOM_ID: h-887ec6d4-535d-4363-a0a7-884717b87a47
:END:
Lets set in a custom varible what packages well be needing.
#+BEGIN_SRC fish :exports code :tangle ~/.yadm/bootstrap
#+BEGIN_SRC fish :exports code
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 \
@ -505,7 +506,7 @@
#+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 :exports code :tangle ~/.yadm/bootstrap
#+BEGIN_SRC fish :exports code
printf "\n# Installing needed packages ##################################################\n\n"
yay -S --needed $PACKAGES
#+END_SRC
@ -517,7 +518,7 @@
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 :exports code :tangle ~/.yadm/bootstrap
#+BEGIN_SRC fish :exports code
printf "\n# Installing tryones compton fork ############################################\n\n"
yay -S compton-tryone-git
#+END_SRC
@ -534,14 +535,14 @@
:CUSTOM_ID: h-429cb31a-fccb-420f-a5aa-21054c45fb38
:END:
First, lets activate Docker.
#+BEGIN_SRC fish :exports code :tangle ~/.yadm/bootstrap
#+BEGIN_SRC fish :exports code
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 :exports code :tangle ~/.yadm/bootstrap
#+BEGIN_SRC fish :exports code
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
@ -554,7 +555,7 @@
:END:
Emacs will run as a user service, which means it wont be launched until we
log in.
#+BEGIN_SRC fish :exports code :tangle ~/.yadm/bootstrap
#+BEGIN_SRC fish :exports code
printf "\n# Enabling Emacs as user service ##############################################\n\n"
systemctl --user enable --now emacs
#+END_SRC
@ -565,7 +566,7 @@
: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 :exports code :tangle ~/.yadm/bootstrap
#+BEGIN_SRC fish :exports code
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"
@ -580,7 +581,7 @@
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
#+BEGIN_SRC fish :exports code
sudo systemctl enable --now ly
sudo systemctl disable getty@tty2
#+END_SRC
@ -595,7 +596,7 @@
:END:
We will be using =fisher= as our extensions manager for Fish. Lets install
it.
#+BEGIN_SRC fish :exports code :tangle ~/.yadm/bootstrap
#+BEGIN_SRC fish :exports code
printf "\n# Installing fisher ###########################################################\n\n"
curl https://git.io/fisher --create-dirs -sLo ~/.config/fish/functions/fisher.fish
#+END_SRC
@ -605,14 +606,14 @@
:CUSTOM_ID: h-3d540273-bdfb-4c63-a05f-2374a010dc29
:END:
I generally use the following extensions in my Fish shell.
#+BEGIN_SRC fish :exports code :tangle ~/.yadm/bootstrap
#+BEGIN_SRC fish :exports code
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 :exports code :tangle ~/.yadm/bootstrap
#+BEGIN_SRC fish :exports code
fisher add $FISHEXTENSIONS
#+END_SRC
@ -631,7 +632,7 @@
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 :exports code :tangle ~/.yadm/bootstrap
#+BEGIN_SRC fish :exports code
printf "\n# Install i3-gaps-rounded #####################################################\n\n"
cd ~/fromGIT
git clone https://github.com/resloved/i3.git i3-gaps-rounded
@ -651,7 +652,7 @@
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 :exports code :tangle ~/.yadm/bootstrap
#+BEGIN_SRC fish :exports code
printf "\n# Install polybar-battery #####################################################\n\n"
cd ~/fromGIT
git clone https://github.com/drdeimos/polybar_another_battery.git
@ -662,7 +663,7 @@
Now, we have our binary, lets symlink it in our local binary directory,
=~/.local/bin=.
#+BEGIN_SRC fish :exports code :tangle ~/.yadm/bootstrap
#+BEGIN_SRC fish :exports code
ln -s polybar-ab ~/.local/bin/polybar-ab
#+END_SRC
@ -672,7 +673,7 @@
: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 :exports code :tangle ~/.yadm/bootstrap
#+BEGIN_SRC fish :exports code
printf "\n# Install Reveal.JS ###########################################################\n\n"
cd ~/fromGIT
git clone https://github.com/hakimel/reveal.js.git
@ -689,14 +690,14 @@
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 :exports code :tangle ~/.yadm/bootstrap
#+BEGIN_SRC fish :exports code
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 :exports code :tangle ~/.yadm/bootstrap
#+BEGIN_SRC fish :exports code
rustup toolchain install stable
#+END_SRC
@ -706,7 +707,7 @@
:END:
Well need some utilities when developing Rust from Emacs, namely =rustfmt=
and =racer=. Lets install them with =cargo=.
#+BEGIN_SRC fish :exports code :tangle ~/.yadm/bootstrap
#+BEGIN_SRC fish :exports code
printf "\n# Add rust utilities ##########################################################\n\n"
cargo install rustfmt racer
#+END_SRC
@ -716,7 +717,7 @@
: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 :exports code :tangle ~/.yadm/bootstrap
#+BEGIN_SRC fish :exports code
printf "\n# Clean the pacman and yay cache ##############################################\n\n"
yay -Sc --noconfirm
#+END_SRC