Home in Nix – dotfile management
hugoreeves.com
Home in Nix – dotfile management
1–10 of 37 posts
Re: Home in Nix – dotfile management
#2Re: Home in Nix – dotfile management
#3I just clone my dotfile repo from github into ~/darkrc and include the config files I want on each system, so my ~/.bashrc will have a "source $HOME/darkrc/bashrc" at the end, ~/.config/ranger/rc.conf will have "source ~/darkrc/ranger.conf", etc.
Re: Home in Nix – dotfile management
#4I just clone my dotfile repo from github into ~/darkrc and include the config files I want on each system, so my ~/.bashrc will have a "source $HOME/darkrc/bashrc" at the end, ~/.config/ranger/rc.conf will have "source ~/darkrc/ranger.conf", etc.
That's certainly one option. The unique thing about dotfiles is that everyone has a different 'best solution'. The setup outlined in my post has the advantage of being highly configurable and programmable. However, for some people it might make more sense to use a plain git repo with symlinks as installing Nix on all their devices could be a nonstarter. I'm curious, what do you use to manage tools that don't have a `…
Re: Home in Nix – dotfile management
#5I wrote about my approach here in case you are interested ( https://germano.dev/dotfiles/ )
Re: Home in Nix – dotfile management
#6Earlier quoted context omitted.
That's certainly one option. The unique thing about dotfiles is that everyone has a different 'best solution'. The setup outlined in my post has the advantage of being highly configurable and programmable. However, for some people it might make more sense to use a plain git repo with symlinks as installing Nix on all their devices could be a nonstarter. I'm curious, what do you use to manage tools that don't have a `…
I used to symlink and have a simple dotfiles repo, but this forces you to have exactly identical rc files. Different computers simply need different setups, so I started with ansible and a few playbooks running locally.
Re: Home in Nix – dotfile management
#7Re: Home in Nix – dotfile management
#8I discovered too late that Nix basically has no support for this.
While NixOS has some very nice features for declarative setup, user environment management boils down to terminal commands for "install package X, remove package Y".
The mentioned home-manager seems more of an awkward hack than a good solution in my view. It builds up a parallel package repository that you have to use besides the actual packages, and requires a lot of additional work if you want to customize something.
In my understanding (possibly incorrent?) it is also not actually immutable, but just dumps down files into $HOME, losing the most interesting aspect of Nix.
In the end I ditched it and stuck to my Ansible setup.
Nix is a great approach, and definitely worth a look, if you can stomach the other downsides (see below). But right now I would only recommend it for deterministic server builds or isolated dev environments, not for managing you main setup.
* Problems:
- There is plenty of documentation, but it is often incoherent, messy, missing important explanations, and it is generally very awkward to get a good insight and understanding of how all the parts fit together.
- The language... it is full of confusing oddities; clearly something that has grown peace by piece. Switching to something more coherent like Gluon (also functional, https://github.com/gluon-lang/gluon) would seem like a better approach to me.
- Packages: The quality can be very hit and miss. I discovered several that are written poorly. Plenty are also outdated/unmaintained. But: considering the niche nature of Nix, the amount of packages is actually quite impressive.
Re: Home in Nix – dotfile management
#9Would prefer GNU stow for simplicity. https://www.gnu.org/software/stow/
[~/code/dotfiles]$ tree -a -R -L 2
├── aws
│ └── .aws
├── git
│ ├── .gitconfig
│ └── .gitignore_global
├── .gitignore
├── .gitmodules
├── gpg
│ └── .gnupg
├── README
├── ssh
│ └── .ssh
├── tmux
│ ├── .tmux
│ └── .tmux.conf
├── vim
│ ├── .viminfo
│ └── .vimrc
└── zsh
├── .oh-my-zsh
└── .zshrc
I can then stow any of these into my home dir with: $cd ~/code/dotfiles
$ stow -t $HOME git
That sets up a link from all the files in my home dir like: .gitconfig -> code/dotfiles/git/.gitconfigRe: Home in Nix – dotfile management
#10Would prefer GNU stow for simplicity. https://www.gnu.org/software/stow/