The idea
you have that one configfile which is just a link to your nix store (e.g. vim
config, etc.). Now for some reason after thw latest rebuild there is a small mistake in that configfile and you wanna change it quickly to see if you can fix it.
Usually you would change the Nix
configfile, nixos/homemanager/... rebuild
, test, realise it’s still wrong, repeat until fixed. This is especially annoying if the only “quick” solution is to rebuild your whole config - which can take ages.
With nix-meddle you can make a nix path “writable”. run the program and select a path from the nix store.
The nix path will be copied to ~/.local/share/meddle/${DATE}_${derivation_name}
and it shows the 2 commands used to first unshare
(a.k.a. make it possible to bind-mount without root) and then mount the directory into the nix store.
Meddle and test around as you wish, and after ctrl-c
(exiting the unshare
), the bind mount will be gone.
State of the project
I’ve hacked together a more or less working version of nix meddle after having thought about it for over a year.
It’s not pretty at all and you’ll even have to manually copy paste 2 commands it shows you. But I thought maybe that’s already enough for someone else, too
Usage
Given it’s very prototypical state it only works with flakes
But with flakes it’s really easy to use
nix run github:Melkor333/nix-meddle
Follow the questions and if everything goes well, copy & paste the 2 commands. Be aware: the commands must be pasted separately, because otherwise the second command is ignored (the first command starts a subshell)
[Not requiring to paste these commands is an open TODO]
Edit: I never again write an article on my phone. My phone keyboard is so broken!