:source-highlighter: highlightjs
:highlightjsdir: highlight
:experimental:
:toc: left
:icons: font
:table-stripes: even

= Introduction
Julien Chappuis <jubijub@gmail.com>

The goal is to reach a complete development environment including code editors, IDEs  and main dev libraries.


== Java
=== Reference
https://wiki.archlinux.org/index.php/java#OpenJDK[ArchLinux Wiki on OpenJDK] to get the package name for the latest version of openjdk JDK.

=== Install
[source, shell]
----
paru -S jdk-openjdk
----

== Python
=== Base python
[source, shell]
----
paru -S python python-pip
----

=== Pyenv

==== Install Pyenv
[source, shell]
----
paru -S pyenv
----

==== Configure Zsh
Add to `.zshenv`
[source, bash]
----
##Add to $PATH
> $HOME/.pyenv

export PYENV_ROOT="$HOME/.pyenv"
----
Add to `.zshrc`
[source, bash]
----
eval "$(pyenv init -)"
----

==== Configure Fish
Add to `config.fish`
[source, bash]
----
fish_add_path $HOME/.pyenv
##Pyenv
set -Ux PYENV_ROOT $HOME/.pyenv
pyenv init - | source
----

==== Install a recent Python version
[source, shell]
----
pyenv install 3.11
pyenv global 3.11
----

=== Poetry
IMPORTANT: Make sure Pyenv has been installed before, and that the desired environment is sourced.

==== Install Poetry
[source, shell]
----
cd ~/Downloads
curl -sSL https://install.python-poetry.org | python3 - <1>
----
<1> this python3 should be the pyenv one.

==== Configure Zsh
Install the Zsh completions:

[source, shell]
----
mkdir ~/.zfunc
poetry completions zsh > ~/.zfunc/_poetry
----
Add to .zshrc, before the `autoload -Uz compinit && compinit` line

[source, bash]
----
##Add before the autoload -Uz compinit && compinit line
fpath+=~/.zfunc
----

===== Install zsh-poetry
Automatically active the virtual env when CDing into a Poetry project
[source, shell]
----
mkdir -p ~/.local/share/zsh-poetry
cd ~/.local/share/zsh-poetry
curl -L git.io/Jinm5 > poetry.zsh
----
Add to .zshrc
[source, bash]
----
source ~/.local/share/zsh-poetry/poetry.zsh
----

==== Configure Fish
Install the Fish completions
[source, shell]
----
poetry completions fish > ~/.config/fish/completions/poetry.fish
----

===== Install fish-poetry
Automatically active the virtual env when CDing into a Poetry project
[source, shell]
----
fisher install 'ryoppippi/fish-poetry'
----

==== Configure Poetry
[source, shell]
----
poetry config virtualenvs.in-project true
----

=== Anaconda
*Reference:* https://docs.anaconda.com/anaconda/install/linux/[Anaconda Linux install guide]

Install the pre-requisites : 
[source, shell]
----
paru -Sy libxau libxi libxss libxtst libxcursor libxcomposite libxdamage libxfixes libxrandr libxrender mesa-libgl  alsa-lib libglvnd
----

Download anaconda from the site https://www.anaconda.com/products/individual

[source, shell]
----
bash ~/Downloads/Anaconda3-2020.02-Linux-x86_64.sh
----

* Accept the install path as /home/<user>/anaconda3
* Accept conda init (it won't do much)
* Configure Anaconda to work with Fish using the script :

[source, shell]
----
/home/jubi/anaconda3/bin/conda init fish
----

== Rust

=== Install
[source, shell]
----
paru -S rustup
rustup component add rust-src rust-analyzer clippy rustfmt
----

=== Configure

==== Rustup (Rust toolchain)
[source, shell]
----
rustup toolchain install stable
rustup default stable
----

==== Shell completions
[source, shell]
----
rustup completions fish > ~/.config/fish/completions/rustup.fish
rustup completions zsh > ~/.zfunc/_rustup
----

== Visual Studio Code (code)

=== Install

[source, shell]
----
paru -S visual-studio-code-bin
----

[%header,cols="1,2,4,2"]
.Extensions
|====
|Language|Name|Install command|Description

|General
|Error Lens
|`code --install-extension usernamehw.errorlens`
|Inline display of compiler errors

|Asciidoc
|Asciidoctor
|`code --install-extension asciidoctor.asciidoctor-vscode`
|Extension for highlighting and authoring ASCIIDoctor content

|Python
|Python
|`code --install-extension ms-python.python`
|The Official Python extension

|TOML
|Even-better-toml
|`code --install-extension tamasfe.even-better-toml`
|A TOML support extension

|Rust
|rust-analyzer
|`code --install-extension rust-lang.rust-analyzer`
|The official Rust extension

|Rust
|Crates
|`code --install-extension serayuzgur.crates` 
| Helper to discover creates versions in Cargo.toml

|====


[%header,cols="1,3,2"]
.Themes
|====
|Name|Install command|Description

|Catppuccin
|`code --install-extension catppuccin.catppuccin-vsc`
|https://github.com/catppuccin/catppuccin[Catppuccin color theme]

|====

=== Configure
Change the font to `JetBrainsMono Nerd Font Mono`

==== Wayland
*Reference* : https://bbs.archlinux.org/viewtopic.php?id=286537

IMPORTANT: Ensures VSCode configuration in `~/.config/Code/User/settings.json` contains `"window.titleBarStyle": "custom"` or VSCode will crash upon startup.

Make sure code is run with the flags
[source]
----
--enable-features=WaylandWindowDecorations #<.>
--ozone-platform-hint=auto #<.>
--enable-webrtc-pipewire-capturer` #<.>
----
<.> prevents missing top bar issues under wayland
<.> generic flag to enable native Wayland
<.> enables Obs capture under wayland


== Jetbrains Toolbox
[source, shell]
----
paru –S jetbrains-toolbox 
----

== CUDA

=== Reference
https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html[nVidia CUDA on Linux installation guide]

=== Installation
[source, shell]
----
paru –S cuda
----

=== Configure CUDA

* Edit shell config
* Add to `$PATH` : `/opt/cuda/bin`
* Add to `fish.config` : `set -gx LD_LIBRARY_PATH LD_LIBRARY_PATH /opt/cuda/lib64`

=== Install samples

==== Reference
https://docs.nvidia.com/cuda/cuda-samples/index.html#getting-samples-on-linux[nVidia CUDA Sample guide - Getting samples on Linux]

[source, shell]
----
cd /data/Projects
git clone https://github.com/NVIDIA/cuda-samples.git
cd cuda-samples/Samples/1_Utilities/deviceQuery/
vim Makefile
----

Edit the path by changing `CUDA_PATH=/opt/cuda/`. This is required because the path is hardcoded in the Makefiles, and this is not the path Arch installer uses.

[source, shell]
----
make <1>
./deviceQuery <2>
----
<1> should run with no issues
<2> will display data about the installed graphic card CUDA capabilities

You can cleanup the samples
[source, shell]
----
cd /data/Projects
rm -rf cuda-samples
----

== Docker

=== Install

[source, shell]
----
paru –S docker
sudo systemctl enable docker.service
sudo systemctl enable containerd.service
----

=== Configure docker

[source, shell]
----
sudo groupadd docker
sudo usermod -aG docker $USER
newgrp docker
----

=== Configure Fish
[source, shell]
----
mkdir -p ~/.config/fish/completions/ 
curl -L https://raw.githubusercontent.com/docker/cli/master/contrib/completion/fish/docker.fish > ~/.config/fish/completions/docker.fish 
----

== Asciidoctor
=== Install Ruby

[source, shell]
----
$ paru -S ruby ruby-bundler
----
Add Ruby gems to your path
[source, shell]
----
## append /home/jubi/.gem/ruby/2.7.0/bin
----

== Manim (Community)

=== Reference

https://docs.manim.community/en/stable/installation/linux.html#required-dependencies[Manim CE install guide]

=== Dependencies

[source, shell]
----
paru -S cairo pango ffmpeg texlive-most texlive-fontsextra
----

=== Create project folder / virtualenv

[source, shell]
----
poetry new /data/Projects/your-project
----

Open the `/data/Projects/your-project/pyproject.toml` and change the python version from `python = "^3.xx"` to `python = "~3.xx"`

[source, shell]
----
poetry add pycairo
poetry add manim
----

Make sure to activate the virtualenv so that all those dependencies are usable.
