Skip to content

Comments

fetchTree: Return a path instead of a store path#10225

Draft
edolstra wants to merge 7 commits intoNixOS:masterfrom
edolstra:lazy-fetchTree
Draft

fetchTree: Return a path instead of a store path#10225
edolstra wants to merge 7 commits intoNixOS:masterfrom
edolstra:lazy-fetchTree

Conversation

@edolstra
Copy link
Member

Motivation

Fixes #10115.

Context

Priorities and Process

Add 👍 to pull requests you find important.

The Nix maintainer team uses a GitHub project board to schedule and track reviews.

@roberth roberth mentioned this pull request Mar 15, 2024
4 tasks
edolstra and others added 4 commits March 25, 2024 12:22
This picks a number of changes from the lazy-trees branch.
As it is hand picked, and does not include some other necessary
changes, it does not build. Subsequent commits will fix that.

I have added a couple of comments of my own as well.

Co-authored-by: Eelco Dolstra <[email protected]>
This fixes the double copy problem and improves performance
for expressions that don't force the whole source to be added to the
store.

Rules for fast expressions:

- Use path literals where possible
   - import ./foo.nix
- Use + operator with slash in string
   - src = fetchTree foo + "/src";
- Use source filtering, lib.fileset

- AVOID toString
- If possible, AVOID interpolations ("${./.}")
- If possible, move slashes into the interpolation to add less to the store
   - "${./src}/foo" -> "${./src/foo}"

toString may be improved later as part of lazy-trees, so these
recommendations are a snapshot. Path values are quite nice though.
This allows clever editors/IDEs to discern the path more easily
for Ctrl+Click navigate to functionality, e.g. when building
.?ref=HEAD
@github-actions github-actions bot added new-cli Relating to the "nix" command with-tests Issues related to testing. PRs with tests have some priority fetching Networking with the outside (non-Nix) world, input locking labels Mar 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fetching Networking with the outside (non-Nix) world, input locking new-cli Relating to the "nix" command with-tests Issues related to testing. PRs with tests have some priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make builtins.fetchTree return a path as its outPath element

2 participants