Hey! it’s been a while that I am using Nix, however, I consider myself a newbie. It was refreshing that I found a community who cares about reproducibility in our industry, as I think our industry exists because of digital computation that made it more reproducible than the analog computations before. So I am happy to be among you
That being said, I only started to using flake yesterday and I blocked! I think in addition to reproducibility, isolation is a good target to have, which opens the doors for scalability, therefore, in my shell.nix files I always defined the HOME
variable to be inside my working directory to isolate most of the side effects of my work with the current project inside the project’s directory. Thus, I can refresh everything in the project by just removing that directory, which feels good! I know it would duplicate the configs and caches, and also, sometimes it’s not very easy to achieve complete isolation with current tools, but isolation is what I sought.
My current blocker is that in shell.nix
userHome = "${builtins.toString ./.user-home}";
it will be a path inside my currently working directory, but in flake.nix
it’s a source directory in nix store, which is also complaining that the filesystem is read only. By the way, I tried the --impure option but there’s no difference! I consider it as a breaking API. But when I searched around I cannot convince myself that it’s a good change. For instance, I found
Obviously you cannot purely depend on the flake’s location on your filesystem, which may change across evaluations or not exist at all
in Possible to impurely read $HOME in flakes by using `~`-paths · Issue #6684 · NixOS/nix · GitHub, while it’s not obvious for me, but I understand it. The problem is that not everything in the world is pure, and the opposite of pure is not impure, it’s side effects, which looks like Nix should provide more tools around them. Maybe because some people think the learning curve is already too steep. But in the end, we need to accept the existence of side effects, then provide a solution for it. Maybe we need to simplify it a lot to keep the community around But in the end, please make it easy for isolation of side effects, such as defining the HOME directory.
I may be wrong about all of this, so please let me know if you have a solution. Thanks!
Additionally, flakes have too many indention! If I couldn’t find a solution, I am going to switch back to shell.nix for now Thanks for your time.