4 ms·
I'm not knowledgeable enough to tackle all of those but for most of them they can be summed up as "they add more hermeticity/reproducibility to the system", and
by JamesSwift 4y ago
I'm not knowledgeable enough to tackle all of those but for most of them they can be summed up as "they add more hermeticity/reproducibility to the system", and (my understanding) is that this is mostly due to how nix-channels work. Basically nix-channels is an environment variable NIX_PATH that works sort of like PATH, and is where your nix derivations would look when resolving references.
So, for example, I could set my NIX_PATH to a private clone of the nix store and have my personal derivations there and builds I did would not be the same as on your machine where you point your NIX_PATH at the canonical upstream.
Flakes require all of these dynamic parts of the build (including the build architecture etc) to be injected as inputs to the system. Similar to how Bazel workspace files work from what I understand.
As part of that standardization of the inputs into a `flake.nix` / `flake.lock` file there was also work done to define a standard interface for a flake as a unit. Before flakes, if you imported another "unit" there was no telling what was being exported by the target (is it a derivation? an overlay?). With flakes there are well-known, enforced patterns on what and how you would expose to consumers.
> How much they replace home-manager.
Not at all really. But home-manager is now provided as a flake and so you no longer need to install it separately, and can instead import their flake to get a fully-working system.
> Context: not a Nix user, but [...]
To be honest, nix is a system you have to actually use to begin to understand and synthesize. As noted, flakes make this hill less steep, but you won't really internalize the value and the system as a whole until you actually start using it some.
- ghoward 4y agoThank you for the explanation. I'm going to go back through everything I've read and see where it helps me. However, I just want to address one thing. > To be honest, nix is a system you have to actually use to begin to understand and synthesize. As noted, flakes make this hill less steep, but you won't really internalize the value and the system as a whole until you actually start using it some. This is discouraging me from trying Nix for a couple of reasons. Having read the thesis, understanding the necessity of reproducible builds and how Nix turns that up to 1100, and looking forward to being able to tell future contributors of my software to just run `nix-shell <whatever>` to set up my exact development environment, I think I understand the value of Nix pretty well. Being told that I don't understand it's value just because I don't use it feels a bit like condescension or elitism. You probably intended none of that, but that's what it felt like. Second, flakes have not made the hill less steep for me; they've made it more steep, simply because understanding wasn't there. Some things are harder for some people than others, including things that seem like they should be easy to anybody. Math is easy for Terence Tao in a way that it's not for me. But I bet you there is something I'm a natural at that he finds hard or impossible. Third, I agree, after all my study, that Nix is easier to understand once you use it. My trouble is that a package manager is a critical part of my system, and I don't want to run it until I do understand it. Standard package managers may be bad compared to Nix, no doubt about it, but they are understandable, which means I've been able to fix them when things go wrong. I have no such confidence that I could do that with Nix, so I haven't used it yet. It is unfortunate, but there are a myriad of reasons why people who know about Nix, and want to use it, haven't yet used it. Sometimes, the reason isn't because they don't understand the value of it. I don't like that I am not yet confident enough to use it, but that's my situation.
- flurie 4y agoI like to think of the nix ecosystem as an Olympic-size pool. These pools caused me a great deal of stress when I was a child, not because I feared drowning, but because I felt like I could not fully understand their enormity. I learned to swim despite this fear, and what finally helped me get over the fear, more than my swimming ability, was focusing on my purpose or activity within the pool. It is easy to feel overwhelmed by the scope of everything within nix. So much of it is great. Many things aren't great at all. I do much better with it when I stop trying to take in the depth of it all and focus on the one small thing I want to do with it at any time. If there's something small and focused that you want to do with nix that elicits joy within you, I think it is good to dive in and learn enough to do that thing. I really like development environments as a focus, but that aligns with my personal and professional interest, and perhaps you want orthogonal systems or containers or application builds instead. There is something to the understanding that comes through experience, but it's not because it helps me realize the thing I can see in my head, but rather because it will sometimes reach out through the machine and slap me very hard in the face. I have been dealing with this issue[1] since it began. It is pervasive, and it is painful. But it helps me realize how fragile this ecosystem we work with is, and it gives me satisfaction knowing that I belong to a group that might happen to surface issues present in safety-critical systems through nothing more than ceaseless rigor. I hope you will join us at some point. I am confident that you will find it enriching. [1] https://github.com/NixOS/nixpkgs/issues/175875 https://github.com/NixOS/nixpkgs/issues/175875
- ghoward 4y agoThis is a great piece of advice. I hope it helps me someday.
- cassepipe 4y ago> Having read the thesis, understanding the necessity of reproducible builds and how Nix turns that up to 1100, and looking forward to being able to tell future contributors of my software to just run `nix-shell <whatever>` to set up my exact development environment, I think I understand the value of Nix pretty well. Being told that I don't understand it's value just because I don't use it feels a bit like condescension or elitism. You probably intended none of that, but that's what it felt like. I am glad that you acknowledge that it is only how it makes you feel as the original comment that are the cause of such obviously weren't intended for you interpret them that way. It's a bit like if I told you that you need to use vim to actually be able to use it efficiently and you told that you had read the manual and understood really well the concept of modal editing. I used to be like you, very confident in that reading, even regularly reading blog posts/articles on a subject was a great way of absorbing knowledge but at some point I have had to admit that that book/article I had read I did not remember much about and when faced with actually using/implementing something and I needed to actually use/implement multiple times to be able to do it by myself.
- oxff 4y ago> nix is a system you have to actually use to begin to understand and synthesize Then it is fairly bad as a tool, you don't wan't to spend disproportionate amount of time learning to use the tool when the goal is to just use the tool and forget about it (ie. using Nix for more deterministic builds).
- rgoulter 4y agoI'd say power tools provide value despite having to put effort into them. It took me a long time to learn git. When starting out, I could only follow some rote commands, and wasn't able to work my way out of mistakes. Or, tools like Vim or Emacs are tools with steep learning curves, but which provide a powerful user experience if you take the time to learn them. -- Although, you can certainly get by using other editors like VSCode without having to put time into them; but I wouldn't consider vim or emacs bad tools. Developers commonly work with packages. (e.g. when installing toolchains, or dependencies for building some package). Having a tool that can so expressively and powerfully deal with packages like Nix can, I think if it's got some rough corners or needs some effort to use, it doesn't discount it as a tool.
- JamesSwift 4y agoWell its not really a tool. Its an overarching system/philosophy, within which there are tools that you can use. Unfortunately the naming muddies that a bit, when people (who usually are newer and so aren't as familiar with the distinctions) use nix to mean the ecosystem, the language, the package manager, or the OS distribution interchangeably.