this post was submitted on 22 Dec 2025
4 points (100.0% liked)
Nix / NixOS
2555 readers
1 users here now
Main links
Videos
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
I think you can use
importto load the expression from each file, and the//operator to combine imported attribute sets. Like this:Edit: This doesn't work - see replies
I followed how u did it but it doesn't seem to work, i keep getting hit with this error:
Whoops! Guess I was wrong. After some experimenting it looks like the flake system parses, but does not evaluate
flake.nixto read inputs. I also experimented with string concatenation, and that failed with the same error:A "thunk" is an expression whose evaluation has been delayed. It's a key piece of lazy evaluation. Remember that every expression in Nix is lazily evaluated.
It looks only literal attribute set, string, and path expressions will work in
inputs. I think that means it is not possible to split inputs over multiple files.yea i think it may just not be possible yet, looking it up more i've seen people talking abt how a big con of flakes is that
flake.nixis not parsed like regular nix files. I'm not sure why they made it work like that but it gets changed eventually cuz that's really too bad we can't do things as simple as importsOne note about
//is that it doesn't deep combine attribute sets, so if you set the .url in one and .inputs.nixpkgs.follows in another then it will only use the second one. I don't think that matters here but it's tripped me up before. I think lib.mkMerge is the deep recursive alternative.Good point! But I think
lib.mkMergeonly merges options in a module system like the ones used in NixOS, Home Manager, and flake-parts configs. In this situation I think the function to use would be lib.attrsets.recursiveUpdate