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

View File

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

View File

@ -231,6 +231,7 @@
** Execute bootstrap ** Execute bootstrap
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: h-c13d132f-9e69-4bb0-838b-29c7c5611f11 :CUSTOM_ID: h-c13d132f-9e69-4bb0-838b-29c7c5611f11
:HEADER-ARGS: :tangle ~/.yadm/bootstrap
:END: :END:
=yadm= comes with a very handy feature: its bootstrap script. We can =yadm= comes with a very handy feature: its bootstrap script. We can
execute it by running the following command: 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 Notice these two header files, we can see this is a fish script, hence why we
need fish (which is my daily shell anyway). need fish (which is my daily shell anyway).
#+BEGIN_SRC fish :exports code :tangle ~/.yadm/bootstrap #+BEGIN_SRC fish :exports code
#!/usr/bin/fish #!/usr/bin/fish
# -*- mode: fish -*- # -*- mode: fish -*-
#+END_SRC #+END_SRC
@ -255,7 +256,7 @@
AZERTY or the American QWERTY layout, so I make it so the Menu key switches 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 for me my layout between these three. This makes it so my xorg configuration
of my keyboard looks like this: of my keyboard looks like this:
#+BEGIN_SRC fish :exports code :tangle ~/.yadm/bootstrap #+BEGIN_SRC fish :exports code
set keyboardconf \ set keyboardconf \
'Section "InputClass" 'Section "InputClass"
Identifier "system-keyboard" Identifier "system-keyboard"
@ -267,7 +268,7 @@
EndSection' EndSection'
#+END_SRC #+END_SRC
So, lets set it as our keyboard configuration. 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" printf "\n# Set keyboard layout #########################################################\n\n"
echo $keyboardconf | sudo tee /etc/X11/xorg.conf.d/00-keyboard.conf echo $keyboardconf | sudo tee /etc/X11/xorg.conf.d/00-keyboard.conf
#+END_SRC #+END_SRC
@ -278,11 +279,11 @@
:END: :END:
I use two main locales, the French and US UTF-8 locales, and I like to keep I use two main locales, the French and US UTF-8 locales, and I like to keep
the Japanese locale activated just in case. 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" set mylocales "en_US.UTF-8 UTF-8" "fr_FR.UTF-8 UTF-8" "ja_JP.UTF-8 UTF-8"
#+END_SRC #+END_SRC
Lets enable these. Lets enable these.
#+BEGIN_SRC fish :exports code :tangle ~/.yadm/bootstrap #+BEGIN_SRC fish :exports code
printf "\n# Set our locale ##############################################################\n\n" printf "\n# Set our locale ##############################################################\n\n"
for item in $mylocales for item in $mylocales
if test (grep -e "#$item" /etc/locale.gen) if test (grep -e "#$item" /etc/locale.gen)
@ -292,7 +293,7 @@
#+END_SRC #+END_SRC
This is my configuration I usually use when it comes to my locale. 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 set localeconf "LANG=en_US.UTF-8
LC_COLLATE=C LC_COLLATE=C
LC_NAME=fr_FR.UTF-8 LC_NAME=fr_FR.UTF-8
@ -306,11 +307,11 @@
LC_MEASUREMENT=fr_FR.UTF-8" LC_MEASUREMENT=fr_FR.UTF-8"
#+END_SRC #+END_SRC
Lets set it as our systems locale. 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 echo $localeconf | sudo tee /etc/locale.conf
#+END_SRC #+END_SRC
Now we can generate our locale! 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" printf "\n# Generate locale #############################################################\n\n"
sudo locale-gen sudo locale-gen
#+END_SRC #+END_SRC
@ -321,7 +322,7 @@
:END: :END:
Lets create some folders we might need for mounting our drives, Android Lets create some folders we might need for mounting our drives, Android
devices and CDs. devices and CDs.
#+BEGIN_SRC fish :exports code :tangle ~/.yadm/bootstrap #+BEGIN_SRC fish :exports code
printf "\n# Create directories for mounting #############################################\n\n" printf "\n# Create directories for mounting #############################################\n\n"
sudo mkdir -p /mnt/{USB,CD,Android} sudo mkdir -p /mnt/{USB,CD,Android}
sudo chown $USER:(id -g $USER) /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 :CUSTOM_ID: h-c1a78394-c156-4a03-ae82-e5e9d4090dab
:END: :END:
First of all, the bootstrap shell will set the users shell to fish. 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" printf "\n# Set fish as the default shell ###############################################\n\n"
chsh -s /usr/bin/fish chsh -s /usr/bin/fish
#+END_SRC #+END_SRC
@ -344,7 +345,7 @@
Now well need to be sure =yay=, our AUR helper, is installed on our system. 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 If it is, we dont need to to anything. However, if it isnt, well install
it manually. it manually.
#+BEGIN_SRC fish :exports code :tangle ~/.yadm/bootstrap #+BEGIN_SRC fish :exports code
if ! test which yay if ! test which yay
printf "\n# Installing yay ##############################################################\n\n" printf "\n# Installing yay ##############################################################\n\n"
cd cd
@ -368,17 +369,17 @@
cloned within our =~/.emacs.d= directory, and git wont let us clone 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 Spacemacs in an already existing and non-empty directory. To make sure it
isnt one, lets delete any potentially existing =~/.emacs.d= directory: 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" printf "\n# Installing Spacemacs ########################################################\n\n"
rm -rf ~/.emacs.d rm -rf ~/.emacs.d
#+END_SRC #+END_SRC
Now we can clone Spacemacs: 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 git clone --single-branch --branch develop https://github.com/syl20bnr/spacemacs ~/.emacs.d
#+END_SRC #+END_SRC
And we can restore what might have been deleted in our =~/.emacs.d/private= And we can restore what might have been deleted in our =~/.emacs.d/private=
directory: directory:
#+BEGIN_SRC fish :exports code :tangle ~/.yadm/bootstrap #+BEGIN_SRC fish :exports code
yadm checkout -- ~/.emacs.d/private/ yadm checkout -- ~/.emacs.d/private/
#+END_SRC #+END_SRC
@ -392,23 +393,23 @@
:END: :END:
This line in the bootstrap script will test if the current user is using my This line in the bootstrap script will test if the current user is using my
username. If yes, its probably me. 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") if ! test (echo "phundrak" | sed -e "s/^.*$USER//I")
#+END_SRC #+END_SRC
If it is me installing and using these dotfiles, I want the remotes of my 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. 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" printf "\n# Update yadms remotes #######################################################\n\n"
yadm remote set-url origin git@labs.phundrak.fr:phundrak/dotfiles.git yadm remote set-url origin git@labs.phundrak.fr:phundrak/dotfiles.git
yadm remote add github git@github.com:phundrak/dotfiles.git yadm remote add github git@github.com:phundrak/dotfiles.git
#+END_SRC #+END_SRC
I will also want to decrypt my encrypted files, such as said ssh keys. 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" printf "\n# Decrypt encrypted dotfiles ##################################################\n\n"
yadm decrypt yadm decrypt
#+END_SRC #+END_SRC
Finally, lets close this =if= statement. Finally, lets close this =if= statement.
#+BEGIN_SRC fish :exports code :tangle ~/.yadm/bootstrap #+BEGIN_SRC fish :exports code
end end
#+END_SRC #+END_SRC
@ -418,7 +419,7 @@
:END: :END:
Before we set our dotfiles up, lets make sure =envtpl= is correctly Before we set our dotfiles up, lets make sure =envtpl= is correctly
installed. This package will be needed for generating our alt dotfiles. 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' printf '\n# Install envtpl ##############################################################\n\n'
yay -Syu python-envtpl-git yay -Syu python-envtpl-git
#+END_SRC #+END_SRC
@ -429,7 +430,7 @@
:END: :END:
Now we can download the various dependencies of our dotfiles. To do so, Now we can download the various dependencies of our dotfiles. To do so,
lets run the following command: 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" printf "\n# Getting yadm susbmodules ####################################################\n\n"
yadm submodule update --init --recursive yadm submodule update --init --recursive
#+END_SRC #+END_SRC
@ -440,7 +441,7 @@
:END: :END:
Now this should be the last manipulation on our dotfiles: lets create our Now this should be the last manipulation on our dotfiles: lets create our
alternate files: alternate files:
#+BEGIN_SRC fish :exports code :tangle ~/.yadm/bootstrap #+BEGIN_SRC fish :exports code
printf "\n# Generating alt files ########################################################\n\n" printf "\n# Generating alt files ########################################################\n\n"
yadm alt yadm alt
#+END_SRC #+END_SRC
@ -450,7 +451,7 @@
:CUSTOM_ID: h-b14d7d03-da49-4a7b-ba05-1c0848bd8e44 :CUSTOM_ID: h-b14d7d03-da49-4a7b-ba05-1c0848bd8e44
:END: :END:
We have some files in [[file:ect/][etc/]] that are to be symlinked to =/etc=. 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) for f in (find ~/.etc -type f)
set dest (echo $f | sed -n 's/^.*etc\(.*\)$/\/etc\1/p') set dest (echo $f | sed -n 's/^.*etc\(.*\)$/\/etc\1/p')
sudo ln -s $f $dest 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 We may also want to symlink our [[file:.nanorc][nanorc]] to the =/root= directory for when we
use =nano= as =sudo=. 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 read --prompt "echo 'Symlink .nanorc to roots .nanorc? (Y/n): ' " -l nanoroot
if test $nanoroot = 'y' || test $nanoroot = "Y" || test $nanoroot = '' if test $nanoroot = 'y' || test $nanoroot = "Y" || test $nanoroot = ''
printf "\n# Symlinking .nanorc to roots .nanorc ########################################\n\n" printf "\n# Symlinking .nanorc to roots .nanorc ########################################\n\n"
@ -472,7 +473,7 @@
:CUSTOM_ID: h-887ec6d4-535d-4363-a0a7-884717b87a47 :CUSTOM_ID: h-887ec6d4-535d-4363-a0a7-884717b87a47
:END: :END:
Lets set in a custom varible what packages well be needing. 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 \ set PACKAGES \
asar ascii aspell-en aspell-fr assimp awesome-terminal-fonts base-devel bat \ asar ascii aspell-en aspell-fr assimp awesome-terminal-fonts base-devel bat \
biber bleachbit bluez-firmware bluez-utils bookworm boost bzip2 chromium clisp \ biber bleachbit bluez-firmware bluez-utils bookworm boost bzip2 chromium clisp \
@ -505,7 +506,7 @@
#+END_SRC #+END_SRC
These are the minimum I would have in my own installation. You can edit it These are the minimum I would have in my own installation. You can edit it
however you want. Lets install those. 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" printf "\n# Installing needed packages ##################################################\n\n"
yay -S --needed $PACKAGES yay -S --needed $PACKAGES
#+END_SRC #+END_SRC
@ -517,7 +518,7 @@
For some reason, I found installing directly this fork does not work, and I 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. need to install it after I installed the regular compton packages.
=compton-tryone-git= will replace =compton= which will be removed. =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" printf "\n# Installing tryones compton fork ############################################\n\n"
yay -S compton-tryone-git yay -S compton-tryone-git
#+END_SRC #+END_SRC
@ -534,14 +535,14 @@
:CUSTOM_ID: h-429cb31a-fccb-420f-a5aa-21054c45fb38 :CUSTOM_ID: h-429cb31a-fccb-420f-a5aa-21054c45fb38
:END: :END:
First, lets activate Docker. 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" printf "\n# Enabling and starting Docker ################################################\n\n"
sudo systemctl enable --now docker sudo systemctl enable --now docker
#+END_SRC #+END_SRC
Now, if we wish it, we can be added to the =docker= group so we wont have 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. 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 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 = '' if test $adddockergroup = 'y' || test $adddockergroup = "Y" || test $adddockergroup = ''
sudo usermod -aG docker $USER sudo usermod -aG docker $USER
@ -554,7 +555,7 @@
:END: :END:
Emacs will run as a user service, which means it wont be launched until we Emacs will run as a user service, which means it wont be launched until we
log in. log in.
#+BEGIN_SRC fish :exports code :tangle ~/.yadm/bootstrap #+BEGIN_SRC fish :exports code
printf "\n# Enabling Emacs as user service ##############################################\n\n" printf "\n# Enabling Emacs as user service ##############################################\n\n"
systemctl --user enable --now emacs systemctl --user enable --now emacs
#+END_SRC #+END_SRC
@ -565,7 +566,7 @@
:END: :END:
Maybe we want to activate an SSH server on our machine. If so, we can Maybe we want to activate an SSH server on our machine. If so, we can
enable it. Lets ask the question. 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 read --prompt "echo 'Do you want to activate the ssh server? (Y/n): ' " -l sshdserver
if test $sshdserver = 'y' || test $sshdserver = "Y" || test $sshdserver = '' if test $sshdserver = 'y' || test $sshdserver = "Y" || test $sshdserver = ''
printf "\n# Enabling ssh server #########################################################\n\n" 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 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 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). 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 enable --now ly
sudo systemctl disable getty@tty2 sudo systemctl disable getty@tty2
#+END_SRC #+END_SRC
@ -595,7 +596,7 @@
:END: :END:
We will be using =fisher= as our extensions manager for Fish. Lets install We will be using =fisher= as our extensions manager for Fish. Lets install
it. it.
#+BEGIN_SRC fish :exports code :tangle ~/.yadm/bootstrap #+BEGIN_SRC fish :exports code
printf "\n# Installing fisher ###########################################################\n\n" printf "\n# Installing fisher ###########################################################\n\n"
curl https://git.io/fisher --create-dirs -sLo ~/.config/fish/functions/fisher.fish curl https://git.io/fisher --create-dirs -sLo ~/.config/fish/functions/fisher.fish
#+END_SRC #+END_SRC
@ -605,14 +606,14 @@
:CUSTOM_ID: h-3d540273-bdfb-4c63-a05f-2374a010dc29 :CUSTOM_ID: h-3d540273-bdfb-4c63-a05f-2374a010dc29
:END: :END:
I generally use the following extensions in my Fish shell. 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 \ set FISHEXTENSIONS \
edc/bass franciscolourenco/done jethrokuan/fzf jethrokuan/z \ edc/bass franciscolourenco/done jethrokuan/fzf jethrokuan/z \
jorgebucaran/fish-getopts laughedelic/pisces matchai/spacefish \ jorgebucaran/fish-getopts laughedelic/pisces matchai/spacefish \
tuvistavie/fish-ssh-agent tuvistavie/fish-ssh-agent
#+END_SRC #+END_SRC
Lets install these: Lets install these:
#+BEGIN_SRC fish :exports code :tangle ~/.yadm/bootstrap #+BEGIN_SRC fish :exports code
fisher add $FISHEXTENSIONS fisher add $FISHEXTENSIONS
#+END_SRC #+END_SRC
@ -631,7 +632,7 @@
needed dependencies for building =i3= installed. Now, lets clone it, build needed dependencies for building =i3= installed. Now, lets clone it, build
it, and install it. Doing this is probably very bad practices though, be it, and install it. Doing this is probably very bad practices though, be
warned. warned.
#+BEGIN_SRC fish :exports code :tangle ~/.yadm/bootstrap #+BEGIN_SRC fish :exports code
printf "\n# Install i3-gaps-rounded #####################################################\n\n" printf "\n# Install i3-gaps-rounded #####################################################\n\n"
cd ~/fromGIT cd ~/fromGIT
git clone https://github.com/resloved/i3.git i3-gaps-rounded 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 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 [[file:.config/i3/config][i3 config]] to indicate my battery level. It also sends a notification on low
battery and on charging completed. 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" printf "\n# Install polybar-battery #####################################################\n\n"
cd ~/fromGIT cd ~/fromGIT
git clone https://github.com/drdeimos/polybar_another_battery.git 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, Now, we have our binary, lets symlink it in our local binary directory,
=~/.local/bin=. =~/.local/bin=.
#+BEGIN_SRC fish :exports code :tangle ~/.yadm/bootstrap #+BEGIN_SRC fish :exports code
ln -s polybar-ab ~/.local/bin/polybar-ab ln -s polybar-ab ~/.local/bin/polybar-ab
#+END_SRC #+END_SRC
@ -672,7 +673,7 @@
:END: :END:
I sometimes use Reveal.JS to make presentations, and I set its location in 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. 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" printf "\n# Install Reveal.JS ###########################################################\n\n"
cd ~/fromGIT cd ~/fromGIT
git clone https://github.com/hakimel/reveal.js.git git clone https://github.com/hakimel/reveal.js.git
@ -689,14 +690,14 @@
When using rust, I bounce between two toolchains, the =stable= toolchain When using rust, I bounce between two toolchains, the =stable= toolchain
and the =nightly= toolchain. To install them, I will use =rustup= which has and the =nightly= toolchain. To install them, I will use =rustup= which has
already been installed. 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" printf "\n# Install the rust toolchains, nightly is the default one #####################\n\n"
rustup default nightly rustup default nightly
#+END_SRC #+END_SRC
This will both download the nightly toolchain and set it as the default 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, one. Yup, I like to live dangerously. Now to install the stable toolchain,
lets run this: lets run this:
#+BEGIN_SRC fish :exports code :tangle ~/.yadm/bootstrap #+BEGIN_SRC fish :exports code
rustup toolchain install stable rustup toolchain install stable
#+END_SRC #+END_SRC
@ -706,7 +707,7 @@
:END: :END:
Well need some utilities when developing Rust from Emacs, namely =rustfmt= Well need some utilities when developing Rust from Emacs, namely =rustfmt=
and =racer=. Lets install them with =cargo=. 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" printf "\n# Add rust utilities ##########################################################\n\n"
cargo install rustfmt racer cargo install rustfmt racer
#+END_SRC #+END_SRC
@ -716,7 +717,7 @@
:CUSTOM_ID: h-fa5307ec-065b-4d06-9d47-05ccde0da8ac :CUSTOM_ID: h-fa5307ec-065b-4d06-9d47-05ccde0da8ac
:END: :END:
Finally, we are almost done! Lets clean the cache of =pacman= and =yay=. 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" printf "\n# Clean the pacman and yay cache ##############################################\n\n"
yay -Sc --noconfirm yay -Sc --noconfirm
#+END_SRC #+END_SRC