Potential confusion between flake.nix and default.nix #190
RitchieFlick
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm not opening this as an issue, because I'm not totally sure if it is an issue or potentially a botched understanding of mine of flake.nix and default.nix.
I already started getting into Nix before zero-to-nix came along, so I know a little bit, but this knowledge unfortunately confused me quite a lot during the first chapters of the quick start guide.
Ex. on https://zero-to-nix.com/start/nix-run:
https://zero-to-nix.com/start/nix-run
...
As someone who has already started learning a little bit of Nix, this was very confusing, because most resources are starting with default.nix, so I was interested how a complete flake.nix would look like in this case, so I went to https://search.nixos.org/flakes? to search for ponysay and didn't find it there. Going to https://github.com/erkin/ponysay also didn't show me a flake.nix so I already was confused where the flake of ponysay was located.
Ex. on https://zero-to-nix.com/start/nix-build-nixpkgs:
The same thing in this example, I was unable to find a bat flake.nix when searching on nixos.org. Following the link https://github.com/NixOS/nixpkgs also didn't show me a flake.nix for bat, the only thing I found was the default.nix for bat, which is not a flake. At first I thought that maybe
nix run
is "backwards compatible" with default.nix so I tried to run it manually, which of course did not work.It took me quite a while before I figured out (I think?) why this actually works, even though bat hasn't any flake.nix file anywhere.
So my question is if it potentially may be a good idea to add a disclosure somewhere which explains this or makes it more clear that
nix run
is not actually loading the default.nix of the corresponding package but that it is loaded via the flake.nix in the root of the nixpkgs repo (which in turn loads /pkgs/release.nix which loads all the package definitions).Again, it is not impossible that my confusion came from a misunderstanding of some of the things I already learned previously about Nix, so I wanted to start this discussion.
Beta Was this translation helpful? Give feedback.
All reactions