More literary programming \o/

This commit is contained in:
Phuntsok Drak-pa 2019-10-23 12:01:19 +02:00
parent 37830b579a
commit 5627854856
5 changed files with 222 additions and 56 deletions

4
.gitignore_global Normal file → Executable file
View File

@ -1 +1,3 @@
*~ ~*
*.out

34
.rustfmt.toml Normal file → Executable file
View File

@ -1,3 +1,33 @@
reorder_imports = true edition = "2018"
binop_separator = "Back"
enum_discrim_align_threshold = 20
fn_single_line = true
format_code_in_doc_comments = true
format_strings = true
hard_tabs = true
max_width = 80 max_width = 80
merge_imports = true
newline_style = Unix
normalize_comments = true
normalize_doc_attributes = true
reorder_impl_items = true
report_fixme = "Always"
todo = "Always"
struct_field_align_threshold = 20
tab_spaces = 2
wrap_comments = true

6
.signature Normal file → Executable file
View File

@ -2,7 +2,5 @@ Lucien “Phundrak” Cartier-Tilet
https://phundrak.fr (Français) https://phundrak.fr (Français)
https://en.phundrak.fr (English) https://en.phundrak.fr (English)
Pensez à notre planète, avez-vous vraiment besoin dimprimer Pensez à notre planète, avez-vous vraiment besoin dimprimer ce courriel ?
ce courriel ? Please mind our planet, do you really need to print this email?
Please mind our planet, do you really need to print this
email?

0
.yadm/bootstrap Normal file → Executable file
View File

View File

@ -44,6 +44,9 @@
- [[#presentation][Presentation]] - [[#presentation][Presentation]]
- [[#screenshots][Screenshots]] - [[#screenshots][Screenshots]]
- [[#features][Features]] - [[#features][Features]]
- [[#email-signature][Email signature]]
- [[#global-gitignore][Global gitignore]]
- [[#rustfmt][Rustfmt]]
- [[#xresources][Xresources]] - [[#xresources][Xresources]]
- [[#dependencies][Dependencies]] - [[#dependencies][Dependencies]]
- [[#installation][Installation]] - [[#installation][Installation]]
@ -134,10 +137,143 @@
comment some of my short config files which do not deserve to have a full org comment some of my short config files which do not deserve to have a full org
file dedicated to them. 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 ** Xresources
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: h-e6f48975-3b86-4a75-a7e5-5cc9edbd9869 :CUSTOM_ID: h-e6f48975-3b86-4a75-a7e5-5cc9edbd9869
:HEADER-ARGS: :tangle ~/.Xresources :HEADER-ARGS: :tangle ~/.Xresources :exports code
:END: :END:
My Xresources file is very short. Indeed, it only contains two lines which 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 are dedicated to my =st= terminal to set its font and shell. The font is set
@ -214,7 +350,7 @@
:CUSTOM_ID: h-da7951ee-e39a-4a59-a05d-7b7fffdc7825 :CUSTOM_ID: h-da7951ee-e39a-4a59-a05d-7b7fffdc7825
:END: :END:
When you boot into the live ISO, execute the following command: When you boot into the live ISO, execute the following command:
#+BEGIN_SRC sh :exports code :tangle no #+BEGIN_SRC sh :exports code
pacman -Sy reflector pacman -Sy reflector
reflector --country France --country Germany --latest 200 \ reflector --country France --country Germany --latest 200 \
--protocol http --protocol https --sort rate \ --protocol http --protocol https --sort rate \
@ -232,7 +368,7 @@
not wish to do it manually. Personally, Ive done it several times already, 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 I know how the distro works, I just want to be able to install my distro
quickly now. quickly now.
#+BEGIN_SRC sh :exports code :tangle no #+BEGIN_SRC sh :exports code
wget archfi.sf.net/archfi wget archfi.sf.net/archfi
# Or from matmoul.github.io/archfi if SourceForge is down # Or from matmoul.github.io/archfi if SourceForge is down
sh archfi sh archfi
@ -251,24 +387,24 @@
:END: :END:
We will need some basic packages in order to run the bootstrap file. So, We will need some basic packages in order to run the bootstrap file. So,
lets install =fish= (our shell running the script) and =git=. lets install =fish= (our shell running the script) and =git=.
#+BEGIN_SRC sh :exports code :tangle no #+BEGIN_SRC sh :exports code
sudo pacman -Sy fish git yadm sudo pacman -Sy fish git yadm
#+END_SRC #+END_SRC
** 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 :HEADER-ARGS: :tangle ~/.yadm/bootstrap :exports code
: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:
#+BEGIN_SRC fish :exports code :tangle no #+BEGIN_SRC fish :tangle no
yadm bootstrap yadm bootstrap
#+END_SRC #+END_SRC
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 #+BEGIN_SRC fish
#!/usr/bin/fish #!/usr/bin/fish
# -*- mode: fish -*- # -*- mode: fish -*-
#+END_SRC #+END_SRC
@ -283,7 +419,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 #+BEGIN_SRC fish
set keyboardconf \ set keyboardconf \
'Section "InputClass" 'Section "InputClass"
Identifier "system-keyboard" Identifier "system-keyboard"
@ -295,7 +431,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 #+BEGIN_SRC fish
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
@ -306,11 +442,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 #+BEGIN_SRC fish
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 #+BEGIN_SRC fish
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)
@ -320,7 +456,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 #+BEGIN_SRC fish
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
@ -334,11 +470,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 #+BEGIN_SRC fish
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 #+BEGIN_SRC fish
printf "\n# Generate locale #############################################################\n\n" printf "\n# Generate locale #############################################################\n\n"
sudo locale-gen sudo locale-gen
#+END_SRC #+END_SRC
@ -349,14 +485,14 @@
: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 #+BEGIN_SRC fish
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}
#+END_SRC #+END_SRC
We also need the following folder for our nano backups. We also need the following folder for our nano backups.
#+BEGIN_SRC fish :exports code #+BEGIN_SRC fish
mkdir -p $HOME/.cache/nano/backups mkdir -p $HOME/.cache/nano/backups
#+END_SRC #+END_SRC
@ -365,7 +501,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 #+BEGIN_SRC fish
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
@ -377,7 +513,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 #+BEGIN_SRC fish
if ! test which yay if ! test which yay
printf "\n# Installing yay ##############################################################\n\n" printf "\n# Installing yay ##############################################################\n\n"
cd cd
@ -401,17 +537,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 #+BEGIN_SRC fish
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 #+BEGIN_SRC fish
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 #+BEGIN_SRC fish
yadm checkout -- ~/.emacs.d/private/ yadm checkout -- ~/.emacs.d/private/
#+END_SRC #+END_SRC
@ -425,23 +561,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 #+BEGIN_SRC fish
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 #+BEGIN_SRC fish
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 #+BEGIN_SRC fish
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 #+BEGIN_SRC fish
end end
#+END_SRC #+END_SRC
@ -451,7 +587,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 #+BEGIN_SRC fish
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
@ -462,7 +598,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 #+BEGIN_SRC fish
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
@ -473,7 +609,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 #+BEGIN_SRC fish
printf "\n# Generating alt files ########################################################\n\n" printf "\n# Generating alt files ########################################################\n\n"
yadm alt yadm alt
#+END_SRC #+END_SRC
@ -483,7 +619,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 #+BEGIN_SRC fish
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
@ -492,7 +628,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 #+BEGIN_SRC fish
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"
@ -505,7 +641,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 #+BEGIN_SRC fish
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 \
@ -538,7 +674,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 #+BEGIN_SRC fish
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
@ -550,7 +686,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 #+BEGIN_SRC fish
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
@ -567,14 +703,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 #+BEGIN_SRC fish
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 #+BEGIN_SRC fish
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
@ -587,7 +723,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 #+BEGIN_SRC fish
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
@ -598,7 +734,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 #+BEGIN_SRC fish
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"
@ -613,7 +749,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 :exports code #+BEGIN_SRC fish
sudo systemctl enable --now ly sudo systemctl enable --now ly
sudo systemctl disable getty@tty2 sudo systemctl disable getty@tty2
#+END_SRC #+END_SRC
@ -628,7 +764,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 #+BEGIN_SRC fish
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
@ -638,14 +774,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 #+BEGIN_SRC fish
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 #+BEGIN_SRC fish
fisher add $FISHEXTENSIONS fisher add $FISHEXTENSIONS
#+END_SRC #+END_SRC
@ -664,7 +800,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 #+BEGIN_SRC fish
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
@ -684,7 +820,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 #+BEGIN_SRC fish
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
@ -695,7 +831,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 #+BEGIN_SRC fish
ln -s polybar-ab ~/.local/bin/polybar-ab ln -s polybar-ab ~/.local/bin/polybar-ab
#+END_SRC #+END_SRC
@ -705,7 +841,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 #+BEGIN_SRC fish
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
@ -722,14 +858,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 #+BEGIN_SRC fish
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 #+BEGIN_SRC fish
rustup toolchain install stable rustup toolchain install stable
#+END_SRC #+END_SRC
@ -739,7 +875,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 #+BEGIN_SRC fish
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
@ -749,7 +885,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 #+BEGIN_SRC fish
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