Coming soon - Get a detailed view of why an account is flagged as spam!
view details

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

17
Newbie questions about flakes and NixOS modules
Post Body

Hi all -- I've recently started trying NixOS, and I've run into a handful of questions I canā€™t answer. I've read through the most relevant portions of the manual and wiki that I could find, plus the earlier Nix Pills and the Tweag blog posts on flakes.

If anyone can answer any of these, I'd appreciate it a ton! Iā€™d also really appreciate any suggestions to help me help myself, like documentation I should read or debugging commands I should use. I donā€™t know C , so I canā€™t dive all that well into the Nix codebase, but I guess I might have to learn some.

1) Right now I'm using a flake to configure NixOS, but most of my configuration is in a module that the flake pulls in. One argument this module expects is pkgs. Based on the wiki (and on calling builtins.trace on pkgs, which wasā€¦ not a great idea), it looks like pkgs is a gigantic attribute set with pretty much every nix package ever.

Iā€™m confused about the difference between the moduleā€™s pkgs input and my flake.nixā€™s nixpkgs input. Nixpkgs isnā€™t a giant attribute set, right? But does it wrap or somehow contain a pkgs attribute set?

Iā€™m also confused about the relationship between my flakeā€™s nixpkgs and my moduleā€™s pkgs. Iā€™m hoping that the moduleā€™s pkgs is somehow coming from my flakeā€™s nixpkgs, or else Iā€™m not sure what the point of the flake and its lockfile really is.

2) Related to the first question -- when a flake includes a module, do that moduleā€™s inputs in any way extend beyond or subvert the flake? Or are the inputs determined entirely by the flake?

3) The third Tweag blog post on flakes suggests setting nix.registry.nixpkgs.flake = nixpkgs to ā€œpinā€ the system-wide flake registryā€™s nixpkgs to the nixpkgs used to build your system. But what is the system-wide flake registry? And what does nixpkgs mean in this context -- is it just one part of my system-wide registry?

4) While trying to understand how follows works for flakes, I ran across this sentence in the manual: ā€œMost flakes provide their functionality through Nixpkgs overlays or NixOS modules, which are composed into the top-level flakeā€™s nixpkgs input.ā€ I donā€™t understand what it means for modules to be ā€œcomposed into the top-level flakeā€™s nixpkgs inputā€. Is nixpkgs actually being modified not only by overlays, but by modules?

5) Iā€™ve noticed that some people include https://nix-community.cachix.org in their nix.binaryCaches list, but when I tried setting that myself, it looked like I was still getting all of my packages from the normal Nix cache site and not Cachix. Will Cachix only be used as a fallback, if the main cache is down or is missing a package? And is it common for there to be packages that you can only find in the community Cachix?

Any answers or help would be super-appreciated. Thanks!

Author
Account Strength
80%
Account Age
10 years
Verified Email
Yes
Verified Flair
No
Total Karma
138
Link Karma
49
Comment Karma
89
Profile updated: 1 month ago
Posts updated: 9 months ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
3 years ago