[Bootstrap] Revamped bootstrap

Rewrite some parts that were not true anymore about my configuration,
add some interactivity for some settings some users would not
necessarily want.

Some parts that are no longer needed are also removed, such as yay
installation (done with archfi), nano, and go packages.

Some list of packages were made into org tables, and the command is
rewritten in litterate programming from these tables.
This commit is contained in:
Lucien Cartier-Tilet 2020-09-28 18:17:07 +02:00
parent 76abb602a2
commit c66e4329bd
Signed by: phundrak
GPG Key ID: BD7789E705CB8DCA
2 changed files with 208 additions and 292 deletions

View File

@ -1,5 +1,9 @@
#!/usr/bin/fish
if test "$USER" = 'phundrak'
yadm decrypt
else
whiptail --yesno "Decrypt private files?" 8 40 && yadm decrypt
end
set keyboardconf \
'Section "InputClass"
@ -12,13 +16,18 @@ set keyboardconf \
EndSection'
printf "\n# Set keyboard layout #########################################################\n\n"
whiptail --yesno "Would you like to set your keyboard layout to the bépo layout?" 8 55
if test $status -eq 0
echo $keyboardconf | sudo tee /etc/X11/xorg.conf.d/00-keyboard.conf
end
set mylocales "en_US.UTF-8 UTF-8" "fr_FR.UTF-8 UTF-8" "ja_JP.UTF-8 UTF-8"
printf "\n# Set locale ##################################################################\n\n"
for item in $mylocales
if test (grep -e "#$item" /etc/locale.gen)
whiptail --yesno "Set the \"$item\" locale?" 8 40
if test $status -eq 0 -a (grep -e "#$item" /etc/locale.gen)
sudo sed -i "/$item/s/^#//g" /etc/locale.gen
end
end
@ -35,7 +44,10 @@ LC_ADDRESS=fr_FR.UTF-8
LC_TIME=fr_FR.UTF-8
LC_MEASUREMENT=fr_FR.UTF-8"
whiptail --yesno "Do you agree to have the following locale set?\n\n $localeconf" 20 43
if test $status -eq 0
echo $localeconf | sudo tee /etc/locale.conf
end
printf "\n# Generate locale #############################################################\n\n"
sudo locale-gen
@ -44,25 +56,12 @@ printf "\n# Create directories for mounting ####################################
sudo mkdir -p /mnt/{USB,CD,Android}
sudo chown $USER:(id -g $USER) /mnt/{USB,CD,Android}
mkdir -p $HOME/.cache/nano/backups
printf "\n# Set fish as the default shell ###############################################\n\n"
if not test "$SHELL" = "/usr/bin/fish"
whiptail --yesno "Set the current users default shell to fish?" 8 50
if test $status -eq 0 -a ! "$SHELL" = '/usr/bin/fish'
chsh -s /usr/bin/fish
end
if ! test (which yay)
printf "\n# Installing yay ##############################################################\n\n"
cd
mkdir -p ~/fromGIT
cd ~/fromGIT
git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -si --noconfirm
else
printf "\n# yay already installed #######################################################\n\n"
end
set PACKAGES \
acpilight adobe-source-han-sans-jp-fonts arc-gtk-theme asar ascii aspell-en \
aspell-fr awesome awesome-terminal-fonts awesome-freedesktop-git base-devel \
@ -157,13 +156,13 @@ emacs -q --batch --eval '(require \'ob-tangle)' \
--eval '(org-babel-tangle-file "~/org/config/tmux.org")'
printf "\n# Installing Spacemacs ########################################################\n\n"
rm -rf ~/.config/emacs
rm -rf $HOME/.config/emacs $HOME/.emacs* .spacemacs
git clone --single-branch --branch develop https://github.com/syl20bnr/spacemacs ~/.config/emacs
git clone --branch develop https://github.com/syl20bnr/spacemacs ~/.config/emacs
yadm checkout -- ~/.config/emacs/private/
if ! test (echo "phundrak" | sed -e "s/^.*$USER//I")
if test "$USER" = 'phundrak'
printf "\n# Update yadms remotes #######################################################\n\n"
yadm remote set-url origin git@labs.phundrak.com:phundrak/dotfiles.git
@ -174,9 +173,6 @@ yadm decrypt
end
printf '\n# Install envtpl ##############################################################\n\n'
yay -Syu --needed python-envtpl-git
printf "\n# Getting yadm susbmodules ####################################################\n\n"
yadm submodule update --init --recursive
@ -194,109 +190,68 @@ if test $adddockergroup = 'y' || test $adddockergroup = "Y" || test $adddockergr
end
printf "\n# Enabling Emacs as user service ##############################################\n\n"
systemctl --user enable --now emacs
systemctl --user enable emacs
printf "\n# Enabling Mpd as a user service ##############################################\n\n"
mkdir -p ~/.config/mpd/playlists
systemctl --user enable --now mpd
read --prompt "echo 'Do you want to activate the ssh server? (Y/n): ' " -l sshdserver
if test $sshdserver = 'y' || test $sshdserver = "Y" || test $sshdserver = ''
whiptail --yesno 'Do you want to activate the ssh server?' 8 50
if test $status -eq 0
printf "\n# Enabling ssh server #########################################################\n\n"
sudo systemctl enable --now sshd
end
sudo systemctl enable --now ly
sudo systemctl disable getty@tty2
sudo systemctl enable --now ly
sudo usermod -aG video $USER
sudo systemctl enable --now nordvpnd
nordvpn s protocol udp
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
end
read --prompt "echo 'Symlink .nanorc to roots .nanorc? (Y/n): ' " -l nanoroot
if test $nanoroot = 'y' || test $nanoroot = "Y" || test $nanoroot = ''
printf "\n# Symlinking .nanorc to roots .nanorc ########################################\n\n"
sudo ln -s $HOME/.nanorc /root/.nanorc
end
mkdir -p ~/fromGIT
printf "\n# Install polybar-battery #####################################################\n\n"
cd ~/fromGIT
git clone https://github.com/drdeimos/polybar_another_battery.git
cd polybar_another_battery
go get -u github.com/distatus/battery/cmd/battery
make build
cd ~/.local/bin
ln -s ~/fromGIT/polybar_another_battery/polybar-ab polybar-ab
printf "\n# Install Reveal.JS ###########################################################\n\n"
cd ~/fromGIT
git clone https://github.com/hakimel/reveal.js.git
printf "\n# Install powerline fonts #####################################################\n\n"
cd ~/fromGIT
git clone https://github.com/powerline/fonts.git --depth=1
cd fonts
./install.sh
fc-cache -vf
printf "\n# Install the rust toolchains, nightly is the default one #####################\n\n"
rustup default nightly
rustup default stable
rustup toolchain install stable
rustup toolchain install nightly
printf "\n# Add rust utilities ##########################################################\n\n"
cargo install rustfmt racer
rustup component add rust-src
rustup component add rls
rustup component add clippy
printf "\n# Installing Python packages ##################################################\n\n"
pip install --user pyls-isort pyls-mypy
printf "\n# Installing Go packages ######################################################\n\n"
go get -v golang.org/x/tools/gopls@latest
go get -u -v golang.org/x/tools/cmd/godoc
go get -u -v golang.org/x/tools/cmd/goimports
go get -u -v golang.org/x/tools/cmd/gorename
go get -u -v golang.org/x/tools/cmd/guru
go get -u -v github.com/cweill/gotests/...
go get -u -v github.com/davidrjenni/reftools/cmd/fillstruct
go get -u -v github.com/fatih/gomodifytags
go get -u -v github.com/godoctor/godoctor
go get -u -v github.com/golangci/golangci-lint/cmd/golangci-lint
go get -u -v github.com/haya14busa/gopkgs/cmd/gopkgs
go get -u -v github.com/josharian/impl
go get -u -v github.com/mdempsky/gocode
go get -u -v github.com/rogpeppe/godef
go get -u -v github.com/zmb3/gogetdoc
go get -u -v golang.org/x/tools/gopls
printf "\n# Setting up Chicken ##########################################################\n\n"
chicken-install -s apropos chicken-doc
cd (chicken-csi -b -e "(import (chicken platform))" -p "(chicken-home)")
curl https://3e8.org/pub/chicken-doc/chicken-doc-repo.tgz | sudo tar zx
printf "\n# Clean the pacman and yay cache ##############################################\n\n"
yay -Sc --noconfirm
printf "\n# Installing fisher ###########################################################\n\n"
curl https://git.io/fisher --create-dirs -sLo ~/.config/fish/functions/fisher.fish
printf "\n# Installing Fisher Extensions ################################################\n\n"
fisher add fishpkg/fish-prompt-metro
fisher add jorgebucaran/fish-bax
fisher add decors/fish-colored-man
fisher add franciscolourenco/done
fisher add jethrokuan/fzf
fisher add jethrokuan/z
fisher add jorgebucaran/fish-bax
fisher add jorgebucaran/fish-getopts
fisher add laughedelic/pisces
fisher add acomagu/fish-async-prompt
fisher add oh-my-fish/theme-bobthefish

View File

@ -24,33 +24,38 @@
:END:
I usually install Arch from the [[https://www.archlinux.org/download/][vanilla ISO]], however I began using [[https://github.com/MatMoul/archfi][archfi]] to
install easily the distro (Ive done it so many times, I know how it works
now). Usually, my distros will be installed on at least two partitions, one
dedicated to =/home=, the other to the root partition =/=.
now). Usually, my distros will be installed on two partitions: ~/home~ and ~/~
(root).
If the computer supports EFI bootloaders, the EFI partition will be mounted on
=/boot=. I generally use rEFInd as my boot manager, but if you are more
comfortable with another one, just install what you want. Be aware that if you
format your =/boot= partition, you will delete all boot managers that already
exist; so, if you are dual-booting, *DO NOT FORMAT IT*. Yes, I made the
mistake of wiping the Windows boot manager.
~/boot/efi~. I generally use ~systemd-boot~ as my boot manager, but if you are
more comfortable with another one, just install what you want. Be aware that
if you format your ~/boot~ partition, you will delete all boot managers that
already exist; so, if you are dual-booting, *DO NOT FORMAT IT*. Yes, I made
the mistake of wiping the Windows boot manager when I used to dual-boot.
The swap partition is always at least 4GB large, and I should have a total of
12GB of combined RAM and swap. This means on my main computer I have 16GB of
RAM and 4GB of swap, but on my thinkpad I have 4GB of RAM and 8GB of swap.
In order to use the ~suspend-then-hibernate~ systemd command, it is necessary
to have a swap partition at least twice the size of your installed RAM. That
is because when this command will be run, the system will try to save the
current state of your machine, stored in your RAM, to the swap filesystem. If
there is not enough space, the command will fail, and you wont be able to use
this command.
** Get the latest live system with fast mirrors
** Get the latest, fastest mirrors
:PROPERTIES:
:CUSTOM_ID: Install_Arch_Linux-Get_the_latest_live_system_with_fast_mirrors-59d2a90d
:CUSTOM_ID: Install_Arch_Linux-Get_the_latest_fastest_mirrors-765401c9
:END:
When you boot into the live ISO, execute the following command:
#+BEGIN_SRC sh :exports code
#+BEGIN_SRC sh
pacman -Sy reflector
reflector -c France -c Germany -l 200 -p http -p https --sort rate \
reflector -c FR -c DE -c BE -l 200 -p http -p https --sort rate \
--save /etc/pacman.d/mirrorlist --verbose
#+END_SRC
This will update the packages from your live ISO, and you will get the best
mirrors for your installation. Of course, change the countries accordingly to
your location.
your location. In my case, I am only interested in French, German, and
Belgian mirrors.
** Install the system
:PROPERTIES:
@ -59,41 +64,46 @@
Then you can use a custom script to ease your installation of Arch if you do
not wish to do it manually. Personally, Ive done it several times already, I
know how the distro works, I just want to be able to install my distro
quickly now.
quickly now. Ill need to download the script with ~wget~, but apparently it
isnt installed by default on Arch ISOs anymore, so Ill need to install it.
#+BEGIN_SRC sh
pacman -S wget
#+END_SRC
Now, lets grab the script. You can check it on [[https://github.com/matmoul/archfi][Github]].
#+BEGIN_SRC sh
wget archfi.sf.net/archfi
# Or from matmoul.github.io/archfi if SourceForge is down
sh archfi
#+END_SRC
Then, follow the instructions and install Arch Linux. Take the opportunity to
install as many packages as you need, mainly =yay= which I use as my package
manager (it is just a wrapper for =pacman=) and AUR helper, and
=pacman-contrib= which will help us installing some packages later.
install as many packages as you need, mainly ~yay~ which I use as my package
manager (it is just a wrapper for ~pacman~) and AUR helper, and
~pacman-contrib~ which will help us installing some packages later.
Once your system is installed, reboot and remove your installation media from
your computer.
* Install basic packages
* Execute bootstrap
:PROPERTIES:
:CUSTOM_ID: Install_basic_packages-c2cfb42d
:HEADER-ARGS:fish: :tangle ~/.config/yadm/bootstrap :shebang "#!/usr/bin/fish" :exports code :mkdirp yes
:CUSTOM_ID: Execute_bootstrap-e37054ef
:END:
We will need some basic packages in order to run the bootstrap file. So, lets
install =fish= (our shell running the script) and =git=.
With the installation of Arch with ~archfi~, I will have [[https://github.com/Jguer/yay][yay]], an AUR helper,
installed. This will allow me to have some basic packages installed in order
to run the bootstrap described below. So, lets install ~fish~ (our shell
running the script), ~git~, and my dotfiles manager ~yadm~.
#+BEGIN_SRC sh
yay -Sy fish git yadm
#+END_SRC
* Execute bootstrap
:PROPERTIES:
:HEADER-ARGS: :tangle ~/.config/yadm/bootstrap :shebang "#!/usr/bin/fish"
:CUSTOM_ID: Execute_bootstrap-e37054ef
:END:
=yadm= comes with a very handy feature: its bootstrap script. It can be
~yadm~ comes with a very handy feature: its bootstrap script. It can be
executed automatically once the dotfiles are cloned with yadm:
#+BEGIN_SRC fish :tangle no
#+BEGIN_SRC sh
yadm clone https://labs.phundrak.com/phundrak/dotfiles
# or if labs.phundrak.com is down or too slow for you
yadm clone https://github.com/phundrak/dotfiles
#yadm clone https://github.com/phundrak/dotfiles
#+END_SRC
Lets take a look at what it does.
@ -105,7 +115,11 @@
Some private files are stored encrypted in the repository of my yadm
dotfiles. I will need them later on during the bootstrap execution.
#+BEGIN_SRC fish
if test "$USER" = 'phundrak'
yadm decrypt
else
whiptail --yesno "Decrypt private files?" 8 40 && yadm decrypt
end
#+END_SRC
** Get a correct keyboard layout
@ -128,10 +142,15 @@
Option "XkbOptions" "caps:ctrl_modifier"
EndSection'
#+END_SRC
So, lets set it as our keyboard configuration.
So, lets ask the user if they want to set it as their keyboard
configuration.
#+BEGIN_SRC fish
printf "\n# Set keyboard layout #########################################################\n\n"
whiptail --yesno "Would you like to set your keyboard layout to the bépo layout?" 8 55
if test $status -eq 0
echo $keyboardconf | sudo tee /etc/X11/xorg.conf.d/00-keyboard.conf
end
#+END_SRC
** Set our locale
@ -143,11 +162,14 @@
#+BEGIN_SRC fish
set mylocales "en_US.UTF-8 UTF-8" "fr_FR.UTF-8 UTF-8" "ja_JP.UTF-8 UTF-8"
#+END_SRC
Lets enable these.
Ill let the user accept them one by one.
#+BEGIN_SRC fish
printf "\n# Set locale ##################################################################\n\n"
for item in $mylocales
if test (grep -e "#$item" /etc/locale.gen)
whiptail --yesno "Set the \"$item\" locale?" 8 40
if test $status -eq 0 -a (grep -e "#$item" /etc/locale.gen)
sudo sed -i "/$item/s/^#//g" /etc/locale.gen
end
end
@ -167,10 +189,15 @@
LC_TIME=fr_FR.UTF-8
LC_MEASUREMENT=fr_FR.UTF-8"
#+END_SRC
Lets set it as our systems locale.
Lets set it as our systems locale if the user whishes to.
#+BEGIN_SRC fish
whiptail --yesno "Do you agree to have the following locale set?\n\n $localeconf" 20 43
if test $status -eq 0
echo $localeconf | sudo tee /etc/locale.conf
end
#+END_SRC
Now we can generate our locale!
#+BEGIN_SRC fish
printf "\n# Generate locale #############################################################\n\n"
@ -189,11 +216,6 @@
sudo chown $USER:(id -g $USER) /mnt/{USB,CD,Android}
#+END_SRC
We also need the following folder for our nano backups.
#+BEGIN_SRC fish
mkdir -p $HOME/.cache/nano/backups
#+END_SRC
** Set users shell to fish
:PROPERTIES:
:CUSTOM_ID: Execute_bootstrap-Set_users_shell_to_fish-1a794be2
@ -201,32 +223,12 @@
First of all, the bootstrap shell will set the users shell to fish.
#+BEGIN_SRC fish
printf "\n# Set fish as the default shell ###############################################\n\n"
if not test "$SHELL" = "/usr/bin/fish"
whiptail --yesno "Set the current users default shell to fish?" 8 50
if test $status -eq 0 -a ! "$SHELL" = '/usr/bin/fish'
chsh -s /usr/bin/fish
end
#+END_SRC
** Install =yay= if it isnt already installed
:PROPERTIES:
:CUSTOM_ID: Execute_bootstrap-Install_=yay=_if_it_isnt_already_installed-1e777b8b
:END:
Now well need to be sure =yay=, our AUR helper, is installed on our system.
If it is, we dont need to to anything. However, if it isnt, well install
it manually.
#+BEGIN_SRC fish
if ! test (which yay)
printf "\n# Installing yay ##############################################################\n\n"
cd
mkdir -p ~/fromGIT
cd ~/fromGIT
git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -si --noconfirm
else
printf "\n# yay already installed #######################################################\n\n"
end
#+END_SRC
** Install basic packages
:PROPERTIES:
:CUSTOM_ID: Execute_bootstrap-Install_basic_packages-17173316
@ -351,7 +353,7 @@
"\n")
#+END_SRC
#+RESULTS[67c945c10d77b620097d8dc7d35017e3c848adc4]: generate-tangle
#+RESULTS[87a25d6c524e8d1346452c54aa42ac3ac09d94cf]: generate-tangle
#+begin_example
printf '\n\n==== Tangling awesome.org\n\n' && \
emacs -q --batch --eval '(require \'ob-tangle)' \
@ -412,19 +414,21 @@
directory:
#+BEGIN_SRC fish
printf "\n# Installing Spacemacs ########################################################\n\n"
rm -rf ~/.config/emacs
rm -rf $HOME/.config/emacs $HOME/.emacs* .spacemacs
#+END_SRC
Now we can clone Spacemacs:
#+BEGIN_SRC fish
git clone --single-branch --branch develop https://github.com/syl20bnr/spacemacs ~/.config/emacs
git clone --branch develop https://github.com/syl20bnr/spacemacs ~/.config/emacs
#+END_SRC
And we can restore what might have been deleted in our =~/.emacs.d/private=
directory:
#+BEGIN_SRC fish
yadm checkout -- ~/.config/emacs/private/
#+END_SRC
** Set up dotfiles
** Set up dotfiles git repository
:PROPERTIES:
:CUSTOM_ID: Execute_bootstrap-Set_up_dotfiles-ab372bd9
:END:
@ -435,8 +439,9 @@
This line in the bootstrap script will test if the current user is using my
username. If yes, its probably me.
#+BEGIN_SRC fish
if ! test (echo "phundrak" | sed -e "s/^.*$USER//I")
if test "$USER" = 'phundrak'
#+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
@ -444,27 +449,18 @@
yadm remote set-url origin git@labs.phundrak.com:phundrak/dotfiles.git
yadm remote add github git@github.com:phundrak/dotfiles.git
#+END_SRC
I will also want to decrypt my encrypted files, such as said ssh keys.
#+BEGIN_SRC fish
printf "\n# Decrypt encrypted dotfiles ##################################################\n\n"
yadm decrypt
#+END_SRC
Finally, lets close this =if= statement.
Finally, lets close this ~if~ statement.
#+BEGIN_SRC fish
end
#+END_SRC
*** Get =envtpl=
:PROPERTIES:
:CUSTOM_ID: Execute_bootstrap-Set_up_dotfiles-Get_=envtpl=-fdf53f64
:END:
Before we set our dotfiles up, lets make sure =envtpl= is correctly
installed. This package will be needed for generating our alt dotfiles.
#+BEGIN_SRC fish
printf '\n# Install envtpl ##############################################################\n\n'
yay -Syu --needed python-envtpl-git
#+END_SRC
*** Update our submodules
:PROPERTIES:
:CUSTOM_ID: Execute_bootstrap-Set_up_dotfiles-Update_our_submodules-3e921579
@ -524,10 +520,13 @@
:CUSTOM_ID: Execute_bootstrap-Enable_some_services-Emacs-c7785c21
:END:
Emacs will run as a user service, which means it wont be launched until we
log in.
log in. However, the service wont be started immediately, I personally
prefer to start a standalone instance in which installing and compiling the
Emacs packages will happen, and then once that is done I will start the
service.
#+BEGIN_SRC fish
printf "\n# Enabling Emacs as user service ##############################################\n\n"
systemctl --user enable --now emacs
systemctl --user enable emacs
#+END_SRC
*** Mpd
@ -549,8 +548,8 @@
Maybe we want to activate an SSH server on our machine. If so, we can enable
it. Lets ask the question.
#+BEGIN_SRC fish
read --prompt "echo 'Do you want to activate the ssh server? (Y/n): ' " -l sshdserver
if test $sshdserver = 'y' || test $sshdserver = "Y" || test $sshdserver = ''
whiptail --yesno 'Do you want to activate the ssh server?' 8 50
if test $status -eq 0
printf "\n# Enabling ssh server #########################################################\n\n"
sudo systemctl enable --now sshd
end
@ -564,18 +563,18 @@
use (I generally dont like using display managers). Lets enable it, and
lets disable tty2 while were at it (Ly uses it to run X).
#+BEGIN_SRC fish
sudo systemctl enable --now ly
sudo systemctl disable getty@tty2
sudo systemctl enable --now ly
#+END_SRC
*** Acpilight
:PROPERTIES:
:CUSTOM_ID: Execute_bootstrap-Enable_some_services-Acpilight-39152794
:END:
=acpilight= is our utility managing the brightness of our screen. There is
~acpilight~ is our utility managing the brightness of our screen. There is
actually no service to enable here, but we must ensure the user is part of
the =video= group so we can modify the brightness of our screen without
using =sudo=.
the ~video~ group so we can modify the brightness of our screen without
using ~sudo~.
#+BEGIN_SRC fish
sudo usermod -aG video $USER
#+END_SRC
@ -585,12 +584,21 @@
:CUSTOM_ID: Execute_bootstrap-Enable_some_services-NordVPN-75c1bd88
:END:
Thanks to the AUR package ~nordvpn-bin~, I no longer have to manually
maintain my VPN connections manually with OpenVPN. However, it requires a
service that we should activate:
maintain my VPN connections with OpenVPN. However, it requires a service
that we should activate:
#+BEGIN_SRC fish
sudo systemctl enable --now nordvpnd
#+END_SRC
Lets also set its default protocol to UDP. This will allow me to use any
port while connected to any WiFi as long as the 443 port is available.
Because yes, I do connect to a WiFi that blocks some important ports, such
as the IMAP and SMTP ports. Thanks University of Paris 8 for being SO
paranoid.
#+BEGIN_SRC fish
nordvpn s protocol udp
#+END_SRC
** Symlink some system config files
:PROPERTIES:
:CUSTOM_ID: Execute_bootstrap-Symlink_some_system_config_files-1dd95175
@ -598,21 +606,11 @@
We have some files in [[file:ect/][etc/]] that are to be symlinked to =/etc=.
#+BEGIN_SRC fish
for f in (find ~/.etc -type f)
set dest (echo $f | sed -n 's/^.*etc\(.*\)$/\/etc\1/p')
set dest (echo $f | sed -n 's|^.*etc\(.*\)$|/etc\1|p')
sudo ln -s $f $dest
end
#+END_SRC
We may also want to symlink our [[file:.nanorc][nanorc]] to the =/root= directory for when we
use =nano= as =sudo=.
#+BEGIN_SRC fish
read --prompt "echo 'Symlink .nanorc to roots .nanorc? (Y/n): ' " -l nanoroot
if test $nanoroot = 'y' || test $nanoroot = "Y" || test $nanoroot = ''
printf "\n# Symlinking .nanorc to roots .nanorc ########################################\n\n"
sudo ln -s $HOME/.nanorc /root/.nanorc
end
#+END_SRC
** Install packages from git
:PROPERTIES:
:CUSTOM_ID: Execute_bootstrap-Install_packages_from_git-7c6a6ea4
@ -622,29 +620,6 @@
mkdir -p ~/fromGIT
#+END_SRC
*** Polybar Battery
:PROPERTIES:
:CUSTOM_ID: Execute_bootstrap-Install_packages_from_git-Polybar_Battery-074a2cf5
:END:
Now lets install =polybar-battery=. This is a binary that Ill use in my [[file:.config/i3/config][i3
config]] to indicate my battery level. It also sends a notification on low
battery and on charging completed.
#+BEGIN_SRC fish
printf "\n# Install polybar-battery #####################################################\n\n"
cd ~/fromGIT
git clone https://github.com/drdeimos/polybar_another_battery.git
cd polybar_another_battery
go get -u github.com/distatus/battery/cmd/battery
make build
#+END_SRC
Now, we have our binary, lets symlink it in our local binary directory,
=~/.local/bin=.
#+BEGIN_SRC fish
cd ~/.local/bin
ln -s ~/fromGIT/polybar_another_battery/polybar-ab polybar-ab
#+END_SRC
*** Reveal.JS
:PROPERTIES:
:CUSTOM_ID: Execute_bootstrap-Install_packages_from_git-Reveal.JS-bb4da0bf
@ -657,20 +632,6 @@
git clone https://github.com/hakimel/reveal.js.git
#+END_SRC
*** Install powerline fonts
:PROPERTIES:
:CUSTOM_ID: Execute_bootstrap-Install_packages_from_git-Install_powerline_fonts-293f256c
:END:
I also need some powerline fonts for my terminal theme.
#+BEGIN_SRC fish
printf "\n# Install powerline fonts #####################################################\n\n"
cd ~/fromGIT
git clone https://github.com/powerline/fonts.git --depth=1
cd fonts
./install.sh
fc-cache -vf
#+END_SRC
** Install Rust
:PROPERTIES:
:CUSTOM_ID: Execute_bootstrap-Install_Rust-1839c4d0
@ -679,35 +640,55 @@
:PROPERTIES:
:CUSTOM_ID: Execute_bootstrap-Install_Rust-Install_the_toolchains-3480764a
:END:
When using rust, I bounce between two toolchains, the =stable= toolchain and
the =nightly= toolchain. To install them, I will use =rustup= which has
already been installed.
When using Rust, I bounce between two toolchains, the ~stable~ toolchain and
the ~nightly~ toolchain, although I try to stick with Rust Stable. To
install them, I will use ~rustup~ which has already been installed
previously.
#+BEGIN_SRC fish
printf "\n# Install the rust toolchains, nightly is the default one #####################\n\n"
rustup default nightly
rustup default stable
#+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:
This will both download the stable toolchain and set it as the default one.
Now to install the nightly toolchain, lets run this:
#+BEGIN_SRC fish
rustup toolchain install stable
rustup toolchain install nightly
#+END_SRC
*** Install some utilities
:PROPERTIES:
:CUSTOM_ID: Execute_bootstrap-Install_Rust-Install_some_utilities-c4a7c785
:END:
Well need some utilities when developing Rust from Emacs, namely =rustfmt=
and =racer=. Lets install them with =cargo=.
Well need some utilities when developing Rust from Emacs, namely ~rustfmt~
and ~racer~. Lets install them with ~cargo~.
#+BEGIN_SRC fish
printf "\n# Add rust utilities ##########################################################\n\n"
cargo install rustfmt racer
#+END_SRC
We will also need some components for development purposes:
#+BEGIN_SRC fish
rustup component add rust-src
rustup component add rls
We will also need some components for development purposes.
#+NAME: rust-components-table
| Component | Why |
|-----------+---------------------------------------------|
| rust-src | Rust documentation in Emacs |
| rls | LSP backend for Emacs |
| clippy | A better version of cargos ~check~ command |
#+NAME: rust-components-gen
#+BEGIN_SRC emacs-lisp :var components=rust-components-table[,0]
(mapconcat (lambda (x) (format "rustup component add %s" x))
components
"\n")
#+END_SRC
#+RESULTS[b3935b1c09d86fe506b43670f52960306a1e9809]:
: rustup component add rust-src
: rustup component add rls
: rustup component add clippy
Here is the code to do so:
#+BEGIN_SRC fish :noweb yes
<<rust-components-gen()>>
#+END_SRC
** Install some python packages
@ -715,36 +696,26 @@
:CUSTOM_ID: Execute_bootstrap-Install_some_python_packages-a4447a6f
:END:
Some packages will be needed from pip in order to get our Emacs setup
correctly working. Lets install them locally for our user:
#+BEGIN_SRC fish
printf "\n# Installing Python packages ##################################################\n\n"
pip install --user pyls-isort pyls-mypy
correctly working.
#+NAME: python-packages-table
| Package | Why |
|------------+-------------------------|
| pyls-isort | Import sortings for LSP |
| pyls-mypy | Mypy linter for LSP |
#+NAME: python-packages-gen
#+BEGIN_SRC emacs-lisp :var packages=python-packages-table[,0]
(format "pip install --user %s"
(s-join " " packages))
#+END_SRC
** Install go packages
:PROPERTIES:
:CUSTOM_ID: Execute_bootstrap-Install_go_packages-fe3e2ff5
:END:
For go development from Emacs, the Spacemacs go and lsp layers requires some
packages to be installed.
#+BEGIN_SRC fish
printf "\n# Installing Go packages ######################################################\n\n"
go get -v golang.org/x/tools/gopls@latest
go get -u -v golang.org/x/tools/cmd/godoc
go get -u -v golang.org/x/tools/cmd/goimports
go get -u -v golang.org/x/tools/cmd/gorename
go get -u -v golang.org/x/tools/cmd/guru
go get -u -v github.com/cweill/gotests/...
go get -u -v github.com/davidrjenni/reftools/cmd/fillstruct
go get -u -v github.com/fatih/gomodifytags
go get -u -v github.com/godoctor/godoctor
go get -u -v github.com/golangci/golangci-lint/cmd/golangci-lint
go get -u -v github.com/haya14busa/gopkgs/cmd/gopkgs
go get -u -v github.com/josharian/impl
go get -u -v github.com/mdempsky/gocode
go get -u -v github.com/rogpeppe/godef
go get -u -v github.com/zmb3/gogetdoc
go get -u -v golang.org/x/tools/gopls
#+RESULTS[949734d540debf625c0067b0b129d630260f1cb1]:
: pip install --user pyls-isort pyls-mypy
Lets install them locally for our user.
#+BEGIN_SRC fish :noweb yes
printf "\n# Installing Python packages ##################################################\n\n"
<<python-packages-gen()>>
#+END_SRC
** Set up Chicken (Scheme interpreter/compiler)
@ -764,16 +735,6 @@
curl https://3e8.org/pub/chicken-doc/chicken-doc-repo.tgz | sudo tar zx
#+END_SRC
** Clean the =pacman= and =yay= cache
:PROPERTIES:
:CUSTOM_ID: Execute_bootstrap-Clean_the_=pacman=_and_=yay=_cache-646cbe36
:END:
Finally, we are almost done! Lets clean the cache of =pacman= and =yay=.
#+BEGIN_SRC fish
printf "\n# Clean the pacman and yay cache ##############################################\n\n"
yay -Sc --noconfirm
#+END_SRC
** Set up our fish shell
:PROPERTIES:
:CUSTOM_ID: Execute_bootstrap-Set_up_our_fish_shell-f0741c22
@ -781,11 +742,11 @@
The last thing we want to do is to set up our fish shell with some extensions
in order to improve the user experience.
*** Install =fisher=
*** Install ~fisher~
:PROPERTIES:
:CUSTOM_ID: Execute_bootstrap-Set_up_our_fish_shell-Install_=fisher=-3a44531b
: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.
#+BEGIN_SRC fish
printf "\n# Installing fisher ###########################################################\n\n"
@ -797,37 +758,37 @@
:CUSTOM_ID: Execute_bootstrap-Set_up_our_fish_shell-Install_our_extensions-188e4566
:END:
I generally use the following extensions in my Fish shell.
#+NAME: fish-extensions
#+NAME: fish-extensions-table
#+CAPTION: Fish extensions managed by Fisher
| Package name | Description |
|---------------------------+------------------------------------------------------------------|
| fishpkg/fish-prompt-metro | Fast, git-aware, space-conscious, Powerline prompt |
| jorgebucaran/fish-bax | Run bash scripts, replaying environment changes in fish |
|-----------------------------+------------------------------------------------------------------|
| decors/fish-colored-man | Color man pages to make them more readable |
| franciscolourenco/done | Automatically receive notifications when a long process finishes |
| jethrokuan/fzf | Improved key bindings for [[https://github.com/junegunn/fzf][junegunn/fzf]] |
| jethrokuan/z | Pure-fish [[https://github.com/rupa/z][rupa/z]]-like directory jumping |
| jorgebucaran/fish-bax | Run bash scripts, replaying environment changes in fish |
| jorgebucaran/fish-getopts | CLI options parser; alternative to the [[https://fishshell.com/docs/current/commands.html#argparse][argparse]] fish builtin |
| laughedelic/pisces | Autoclose parentheses, braces, quotes and other paired symbols |
| acomagu/fish-async-prompt | Make your prompt asynchronous to increase it reactivity |
| oh-my-fish/theme-bobthefish | A Powerline-style, Git-aware fish theme optimized for awesome. |
#+NAME: fish-ext-py
#+BEGIN_SRC emacs-lisp :exports none :tangle no :var extensions=fish-extensions[,0]
#+NAME: fish-extensions-gen
#+BEGIN_SRC emacs-lisp :var extensions=fish-extensions-table[,0]
(mapconcat (lambda (x) (format "fisher add %s" x))
extensions
"\n")
#+END_SRC
#+RESULTS[e8afa907b582d6c8c9cb206a5a6be9a3f0f5f657]: fish-ext-py
: fisher add fishpkg/fish-prompt-metro
: fisher add jorgebucaran/fish-bax
#+RESULTS[a88b321ba9148acc8c28c7fb1aaf924c23b6b072]: fish-extensions-gen
: fisher add decors/fish-colored-man
: fisher add franciscolourenco/done
: fisher add jethrokuan/fzf
: fisher add jethrokuan/z
: fisher add jorgebucaran/fish-bax
: fisher add jorgebucaran/fish-getopts
: fisher add laughedelic/pisces
: fisher add acomagu/fish-async-prompt
: fisher add oh-my-fish/theme-bobthefish
#+BEGIN_SRC fish :noweb yes
printf "\n# Installing Fisher Extensions ################################################\n\n"
<<fish-ext-py()>>
<<fish-extensions-gen()>>
#+END_SRC