My dotfiles story (wip)
link to my dotfiles: https://github.com/mudiarto/dotfiles
I love to tinker with my environment, since I love playing with shiny tools, and hopefully to increase my productivity.
I have a growing collections of cli tools, scripts, and configurations that I have been building over the years, but they are not very organized. They are also in private repository so it is a bit hard to pull when I work on new environment.
I want to make it more organized, and make it public so I can use it across different machines. I want to make my computer setup like cattle, not pets.
This is my current dotfiles repository in github. I will try to document the process/thoughts of how I setup my dotfiles here while I’m rebuilding it from scratch.
Tools used
chezmoi
I used to manage my dotfiles using stow, but it is a bit hard to manage with different machines and OS. It seems that chezmoi is trying to solve this problem. I will give it a try.
xonsh
I used to use zsh, but I never comfortable doing scripting in it. I want to experiment with xonsh as my shell, since it is python based, and seems to be more powerful & flexible.
The interesting things about xonsh is that it has 2 modes, python mode and shell mode. My initial confusion is to differentiate which mode it is in, and also the string manipulation between python and shell mode.
Once I got the hang of it, I really enjoy using it.
Couple notes/issues that I encountered:
- Install it using mamba to have a stable installation that doesn’t depend on OS
- Mutagen sync issue because of anything printed during startup in xonsh will be returned to ssh, which cause this issue: “mutagen Error: server handshake failed: unable to receive client magic number: EOF”
- VI mode give this error when I cut something in command line:
Pyperclip could not find a copy/paste mechanism for your system.
- the reason it happens is because I run xonsh remotely via ssh, and there is no X11 window to use as clipboard.
- I tried couple things (including installing Xquartz in my mac) which didn’t solve the issue
- My solution is to disable the clipboard
mise-en-place - replacement for asdf
I have been using asdf for a long time and so far I like it, although sometimes the shims is a bit annoying, and can be quite confusing.
I found this new tools called mise-en-place, and I want to give it a try. If not, I can always go back to asdf.
Since I already have cargo installed (for couple other things), I’ll just use cargo installation instruction.
I’m using cargo binstall method, since this is the first time I heard about it, and I’m curious as well.
cargo install cargo-binstall
cargo binstall mise
also since I use xonsh, i’m following its instruction for xonsh. However, when I run it, I got this error: name 'subprocess' is not defined
- which is fixed by adding import subprocess
in the script. I also need to change the mise location to ~/.cargo/bin/mise
since I use cargo to install it.
However it didn’t work! - I got this weird error: No such file or directory: 'command'
when I run mise.
I then tried to look at the activation script manually, copy pasted it to my mise.xsh and look at it manually. It turned out for some reason the script contain something like subprocess.run(['command', 'mise', *args]...)
and apparently it failed on the first ‘command’. I edited the script, removed the ‘command’ and it seems to work so far.
I also added some check to ensure mise is installed, and failed silently if not.
final script that I use is here