Replicating My Environment On My University's Lab

These last few months I haven't been bringing my laptop to classes, mostly because it's having some problems with the keyboard and it's also kind of breaking apart (it's an old laptop), so I came up with a script to replicate some of the workflow I usually have at my desktop.

To summarize it, the key things about my setup if I had to say would be the window manager and the text editor. They are key to everything I do, so, I thought of installing them on the university's computers, which was easier than I expected

The script

This is the script:

#!/bin/bash

echo 'export PATH=$PATH:~/.local/bin' >> ~/.bashrc
echo 'setxkbmap us intl ctrl:nocaps' >> ~/.bashrc
echo 'alias intellij="flatpak run com.jetbrains.IntelliJ-IDEA-Ultimate"' >> ~/.bashrc

mkdir ~/.local/bin -p

git clone https://git.suckless.org/dwm --depth 1 && cd dwm && make && mv dwm ~/.local/bin
cd ~

git clone https://git.suckless.org/dmenu --depth 1 && cd dmenu && make && mv dmenu* ~/.local/bin
cd ~

git clone https://git.suckless.org/st --depth 1 && cd st && make && mv st ~/.local/bin
cd ~

echo 'PATH=$PATH:~/.local/bin exec ~/.local/bin/dwm' > ~/.xinitrc

chmod +x ~/.xinitrc

git config --global user.name jabuxas
git config --global user.email jabuxas@proton.me
git config --global credential.helper store

pkill -KILL -U $USER

# GETting
wget https://github.com/nix-community/nix-user-chroot/releases/download/1.2.2/nix-user-chroot-bin-1.2.2-x86_64-unknown-linux-musl
wget https://github.com/tectonic-typesetting/tectonic/releases/download/continuous/tectonic-0.15.0+20250221-x86_64-unknown-linux-gnu.tar.gz
git clone --depth 1 https://github.com/doomemacs/doomemacs ~/.config/emacs
git clone https://github.com/jabuxas/configs --depth 1


# tectonic
tar xvf tectonic*
mkdir ~/bin
mv tectonic bin

# nix'ing
mkdir -m 0755 ~/.nix
mv nix-user-chroot-bin-1.2.2-x86_64-unknown-linux-musl nix-user-chroot
chmod +x nix-user-chroot
/home/aluno/nix-user-chroot ~/.nix bash -c 'curl -L https://nixos.org/nix/install | sh'

echo '. /home/aluno/.nix-profile/etc/profile.d/nix.sh' >> ~/.bashrc

# chroot bypassing
/home/aluno/nix-user-chroot ~/.nix bash <<"EOT"
. .bashrc

export PATH=$PATH:~/bin

nix-env -iA nixpkgs.emacs || die "it failed bruh"

nix-env -iA nixpkgs.ripgrep

yes | ~/.config/emacs/bin/doom install

mv configs/shared/.config/doom/* ~/.config/doom/

~/.config/emacs/bin/doom sync

EOT

This script first installs dwm locally, then we install nix locally as well with nix-user-chroot to install Doom Emacs, I install tectonic and texlab because I'm just using Emacs to use ORG mode in Uni.

That's it, it took some attempts to get it right and get everything setup correctly, but in the end it was easier than expected.

written by jabuxas contact info: jabuxas@proton.me