Skip to content

Configurations for Neovim | VSCode | Zsh | Tmux | Nix Home Nanager | MacOS | Hyprland

License

Notifications You must be signed in to change notification settings

Archisman-Mridha/dotfiles

Repository files navigation

Dotfiles

Zsh Tmux Neovim MacOS Wezterm Linux Arch Linux Hyprland

Installing Arch Linux

You can follow this tutorial : https://www.youtube.com/watch?v=FxeriGuJKTM&t=354s, to install Arch Linux using the Arch Linux Installer. Just make sure you choose Hyprland as the desktop environment and NetworkManager as the network management tool.

You can list available wifi networks using this command :

nmcli dev wifi list

and connect with one, using this command :

nmcli dev wifi connect <SSID> password <password>

To verify that you're successfully connected to your wifi, run this command :

ip addr show

the wlan0 network interface must have an IPv4 address assigned.

Setup

First install Nix :

curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install

Then get into a temporary Nix shell, where you'll have access to git, stow and home-manager.

nix-shell -p git stow home-manager vim

Clone this repository :

git clone https://github.com/Archisman-Mridha/dotfiles ~/dotfiles
cd ~/dotfiles

You can customize .config/home-manager/config.nix based on your underlying system. Then execute the following commands :

stow --no-folding .

home-manager switch --impure

On MacOS, run the following to install nix-darwin :

nix run nix-darwin -- switch --flake $(pwd)/.config/home-manager

The packages specified in packages.nix and homebrew.nix will be installed in your system.

Execute this command, if you want to cleanup Nix cache :

nix-collect-garbage -d

Arch Linux specific gotchas

  • While executing stow --no-folding ., in Arch Linux, if you get an error as such :

     * cannot stow dotfiles/.config/hypr/hyprland.conf over existing target .config/hypr/hyprland.conf since neither a link nor a directory and --adopt not specified
    

    In that case, first execute stow --no-folding . --adopt. Then, navigate to ~/.config/hypr/hyprland.conf and replace the content with whatever is present here.

  • If you're in Arch Linux, your default shell will be Bash. And as far as I know, we cannot change the default shell using HomeManager (since that requires root privileges). So, manually execute the following commands, to make zsh your default shell :

     grep -qxF $(which zsh) /etc/shells || echo $(which zsh) | sudo tee -a /etc/shells
     chsh -s $(which zsh)
  • zsh plugin manager isn't automatically installing kube-ps1. So you need to do it yourself :

     yay -S kube-ps1
  • Run this, so SSHD starts up automatically on boot :

     sudo systemctl enable sshd

Updating packages

Go to ./.config/home-manager/ and run :

nix flake update
home-manager switch --impure

Password management using gopass

Bootstrap

Since, the company I currently work for uses Password Store, I will be settling with gopass for now. But, if someday I discontinue working with them, I'll might give sops-nix a try.

First, generate a GPG key-pair (which never expires), using this command :

gpg --gen-key
gpg --edit-key <gpg-key-id>

Make sure you backup this GPG key-pair somewhere safe. You can view the actual public and private keys using :

gpg --export --armor <gpg-key-id>
gpg --export-secret-keys --armor <gpg-key-id>

Next, initialize the password store using :

pass init <gpg-key-id>

You can follow this tutorial, to learn further more about gopass : https://youtu.be/FhwsfH2TpFA?si=ZIo4NmrTHEcgxS_u.

Concurrent setups

First, import and trust the GPG keypair :

gpg --import password-store.private-key.gpg
gpg --import password-store.public-key.gpg

gpg --edit-key <GPG key-pair id> (and then type trust and hit Enter)

Then, as usual, initialize the password store using pass init <GPG key-id>.

The SSH key-pair I use to sign commits and authenticate against Github, is stored at personal/github/ssh. So, I use these commands to complete my Github setup :

pass show personal/github/ssh/private-key > ~/.ssh/github
pass show personal/github/ssh/public-key  > ~/.ssh/github.pub

Don't forget to set correct file permission for the private key file :

chmod 600 ~/.ssh/github.pub

otherwise you'll get file permissions too open error.

A small script can be made for a better UX.

Wezterm (and tmux)

Working in my Arch Linux machine from my Macbook

Everytime, I connect to the wifi from my Arch Linux machine, I want it to get assigned with the same private IPv4 address : 192.168.29.146/24. I can pull it off, using this command :

sudo nmcli connection modify "Bandwidth 5" \
  ipv4.method manual \
  ipv4.addresses "192.168.29.146/24" \
  ipv4.gateway "192.168.29.1" \
  ipv4.dns "8.8.8.8 8.8.4.4"

sudo nmcli connection up "Bandwidth 5"

In my Macbook, I open Neovim and run :DistantInstall. This will install the distant binary in my Macbook. Then, I run :DistantLaunch ssh://<username>@<ip or hostname> to connect to the Arch Linux machine.

distant.nvim currently doesn't support NeoTree and Telescope integration. But work on them is ongoing. So, as of now, I just SSH into my Arch Linux machine and run Neovim within that SSH session.

Cheatsheets

Previews

  • Neovim Neovim

  • Wezterm Wezterm

  • VSCode VSCode

  • Wallpaper CyberPunk

References

TODOs

  • Detect the underlying OS and CPU architecture, based on which the macos.config.nix or the archlinux.config.nix will be imported in flake.nix.

  • Setup gopass.

  • Configure Hyprland.

  • Shift the files inside .config/home-manager to .config/nix. The .config/home-manager name is a bit confusing, since it contains files related to both HomeManager and nix-darwin.

    I tried to do so, but was getting this error while doing `home-manager switch --flake ~/.config/nix#"archismanmridha" :

      access to absolute path '/nix/dotfiles' is forbidden in pure evaluation mode (use '--impure' to override)
    

    Using the --impure flag didn't solve the issue.

  • Enable image support in Neovim

  • Setup distant.nvim - lualine integration