builtins.getFlake: Handle path:<p> where p has a discarded string context - #402
Conversation
…text
For instance, github:Mic92/sops-nix/8b89f44c2cc4581e402111d928869fe7ba9f7033 does this:
loadPrivateFlake =
path:
let
flakeHash = builtins.readFile "${toString path}.narHash";
flakePath = "path:${toString path}?narHash=${flakeHash}";
in
builtins.getFlake (builtins.unsafeDiscardStringContext flakePath);
This previously resulted in
error: path '/nix/store/2c8r30kz9zg8kz11ngp64ah5ya0hc011-source/dev/private/flake.nix' does not exist
Fixes #345.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
This builds on top of #14050 to actually make flakes get lazily copied to the store. This repurposes a slightly less lazy (but also more deterministic) approach that determinate nix has taken. We do still pay to cost of hashing an input once to compute the store path and narHash daemon-client-side. This could be improved in follow-ups in case we don't actually need to check the narHash (like during local development). We need certain backwards compatibility hacks for getFlake with a discarded string context, those are similar to what detnix does. See: DeterminateSystems#422 See: DeterminateSystems#402 Co-authored-by: Eelco Dolstra <edolstra@gmail.com>
This builds on top of #14050 to actually make flakes get lazily copied to the store. This repurposes a slightly less lazy (but also more deterministic) approach than determinate nix has taken. We do still pay to cost of hashing an input once to compute the store path and narHash daemon-client-side. This could be improved in follow-ups in case we don't actually need to check the narHash (like during local development). We need certain backwards compatibility hacks for getFlake with a discarded string context, those are similar to what detnix does. See: DeterminateSystems#422 See: DeterminateSystems#402 Co-authored-by: Eelco Dolstra <edolstra@gmail.com>
This builds on top of #14050 to actually make flakes get lazily copied to the store. This repurposes a slightly less lazy (but also more deterministic) approach than determinate nix has taken. We do still pay to cost of hashing an input once to compute the store path and narHash daemon-client-side. This could be improved in follow-ups in case we don't actually need to check the narHash (like during local development). We need certain backwards compatibility hacks for getFlake with a discarded string context, those are similar to what detnix does. See: DeterminateSystems#422 See: DeterminateSystems#402 Co-authored-by: Eelco Dolstra <edolstra@gmail.com>
This builds on top of #14050 to actually make flakes get lazily copied to the store. This repurposes a slightly less lazy (but also more deterministic) approach than determinate nix has taken. We do still pay to cost of hashing an input once to compute the store path and narHash daemon-client-side. This could be improved in follow-ups in case we don't actually need to check the narHash (like during local development). We need certain backwards compatibility hacks for getFlake with a discarded string context, those are similar to what detnix does. See: DeterminateSystems#422 See: DeterminateSystems#402 Co-authored-by: Eelco Dolstra <edolstra@gmail.com>
This builds on top of #14050 to actually make flakes get lazily copied to the store. This repurposes a slightly less lazy (but also more deterministic) approach than determinate nix has taken. We do still pay to cost of hashing an input once to compute the store path and narHash daemon-client-side. This could be improved in follow-ups in case we don't actually need to check the narHash (like during local development). We need certain backwards compatibility hacks for getFlake with a discarded string context, those are similar to what detnix does. See: DeterminateSystems#422 See: DeterminateSystems#402 Co-authored-by: Eelco Dolstra <edolstra@gmail.com>
This builds on top of NixOS#14050 to actually make flakes get lazily copied to the store. This repurposes a slightly less lazy (but also more deterministic) approach than determinate nix has taken. We do still pay to cost of hashing an input once to compute the store path and narHash daemon-client-side. This could be improved in follow-ups in case we don't actually need to check the narHash (like during local development). We need certain backwards compatibility hacks for getFlake with a discarded string context, those are similar to what detnix does. See: DeterminateSystems#422 See: DeterminateSystems#402 Co-authored-by: Eelco Dolstra <edolstra@gmail.com>
Motivation
For instance, github:Mic92/sops-nix/8b89f44c2cc4581e402111d928869fe7ba9f7033 does this:
This previously resulted in
when using lazy trees.
Fixes #345.
Context
Summary by CodeRabbit