Live data from Hacker News

Home in Nix – dotfile management

hugoreeves.com

21–30 of 37 posts

Re: Home in Nix – dotfile management

#22
post #12

Earlier quoted context omitted.

The documentation is not much aimed on a developer workflow. The `shell.nix` files make it easy to place the environment setup in your repository. The file contains the list of packages that you need and you can make these packages available in just one shell by calling `nix-shell`. Here's an example of a `shell.nix` file: with import {}; stdenv.mkDerivation { name = "cv-env"; buildInputs = [ libxslt gnumake openjdk…

I tried to do this, but I ran into way too many problems. Each approach I tried failed because of some limitation that made the whole thing awkward or pointless. (like symlinking immutable config files into $HOME) This admittedly might have been exacerbated by my shallow understanding.

I do this. When I run into problems with a shell.nix, I fix the underlying project, or abandon it. Nix is ruthless but being ruthless is required in the face of the task of taming decades of terrible software.

Re: Home in Nix – dotfile management

#23
post #8

I tried out Nix recently, with the intention of using it to get declarative management of my user account. I 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…

> In the end I ditched it and stuck to my Ansible setup.

For your own workstation- what OS?

Have you got these in github or somewhere i could take a look?

Re: Home in Nix – dotfile management

#24
post #3

I 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 `…

Generally speaking, I avoid those tools. One example where this happens is rifle; in that case I just have a symlink. Alternatively, one could also just get a standalone C preprocessor and add a git hook to recompile files whenever you commit/pull some new changes.

Re: Home in Nix – dotfile management

#25
post #8

I tried out Nix recently, with the intention of using it to get declarative management of my user account. I 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…

Nix/OS definitely has some rough edges and discovery problems.

I can't comment directly on home manager, and I have had to put a lot of work into adopting Nix, but FWIW I'm happily using it to manage my NixOS desktop at home (since early 2018; my first daily-driver Linux system) and my macbook (since late 2018--though, caution: Nix hasn't really settled into Catalina yet).

Not quite sure how to express it. I guess the ecosystem isn't yet a full-throated embodiment of its own vision for computing. But, if you buy into the vision enough to sweat a little for it, it is livable.

Re: Home in Nix – dotfile management

#28
post #7

Would prefer GNU stow for simplicity. https://www.gnu.org/software/stow/

I used stow for a long time but I changed to Ansible because I started outgrowing stow. Things can't at all / can't simply do with stow: - assemble different .ssh/config for different machines - different .zshenv, .zshrc - encrypt secrets in the git repo? - handle different operating systems condifitionally (can't source the same files on OS X than Linux) - can't install system-wide packages, which would be needed for dotfiles to work properly

Re: Home in Nix – dotfile management

#29
post #21

My $HOME is a git repo for my dotfiles, with a .gitignore containing just "*". Simple, zero abstractions, no need for additional management.

I've recently started using yadm, which is a light abstraction on top of git. One big reason - "Alternate Files" support - which makes it easy to have MacOS and Linux binaries for the same tools, along with the rest of my shell setup, in one Git repo.
Post reply on HN