Skip to content

builtins.fetchTree requires flakes #5541

Open

Description

@samueldr

Describe the bug

Going from the release notes, builtins.fetchTree isn't described as requiring flakes to be enabled.

builtins.fetchTree allows fetching a source tree using any backends supported by the fetcher infrastructure. It subsumes the functionality of existing built-ins like fetchGit, fetchMercurial and fetchTarball.

Steps To Reproduce

[nix-shell:~/tmp/nix]$ ./outputs/out/bin/nix --extra-experimental-features nix-command repl
Welcome to Nix 2.5. Type :? for help.

nix-repl> builtins.fetchTree {}
error: experimental Nix feature 'flakes' is disabled; use '--extra-experimental-features flakes' to override

Expected behavior

builtins.fetchTree to be available even without flakes being enabled.

nix-env --version output

Built from 9d5c985

Additional context

This may be a documentation bug. But I suspect it shouldn't be.

Activity

  1. roberth commented on Nov 18, 2021

    @roberth
    Member

    Maybe it's because of the reproducibility issues that it's gated, but then it should be a different feature flag like unstable-fetchers or something.

  2. samueldr commented on Nov 18, 2021

    @samueldr
    MemberAuthor

    @edolstra any input on that?

  3. nixos-discourse commented on Nov 26, 2021

    @nixos-discourse

    This issue has been mentioned on NixOS Discourse. There might be relevant details there:

    https://discourse.nixos.org/t/nix-2-4-and-what-s-next/16257/1

  4. AleXoundOS commented on Dec 24, 2021

    @AleXoundOS

    Yes, it is highly desirable to have builtins.fetchTree without flakes requirement or additional toggles. For example, companies that have a forked nixpkgs repository with ssh access need shallow clone feature to avoid downloading and storing 1.8 GiB with builtins.fetchGit (though, shallow feature is currently broken).

  5. stale commented on Jul 10, 2022

    @stale

    I marked this as stale due to inactivity. → More info

  6. moved this to ✅ Assigned for merging in Nix teamon Dec 9, 2022
  7. nixos-discourse commented on Dec 12, 2022

    @nixos-discourse
  8. fricklerhandwerk commented on Dec 12, 2022

    @fricklerhandwerk
    Contributor

    Discussed in Nix team meeting 2022-12-09:

  9. moved this from ✅ Assigned for merging to ⏰ Postponed in Nix teamon Jan 2, 2023
  10. added
    idea approved
    on Apr 14, 2023
  11. roberth commented on May 19, 2023

    @roberth
    Member
  12. removed their assignment
    on Apr 26, 2024
  13. MattSturgeon commented on May 22, 2026

    @MattSturgeon
    Contributor

    I noticed the manual documents a fetch-tree experimental feature, and #15654 fixes an issue where URL fetches don't work without the flakes experimental feature.

    I have a similar example:

    $ nix --version
    nix (Nix) 2.34.6
    
    $ nix-instantiate --option experimental-features fetch-tree --eval --expr '
        fetchTree {
          type = "github";
          owner = "NixOS";
          repo = "nixpkgs";
          rev = "d99b013d5d1931ad77fe3912ed218170dec5d9a4";
          narHash = "sha256-7DKWmH23hL2eYdkxCKeqj2i+yljTKuU+3Nk1UPHOnxc=";
          lastModified = 1779259093;
        }
      '
    error:
           … while calling the 'fetchTree' builtin
             at «string»:1:1:
                1| fetchTree {
                 | ^
                2|   type = "github";
    
           error: experimental Nix feature 'flakes' is disabled; add '--extra-experimental-features flakes' to enable it
    

    fetch-tree enables the fetchTree builtin, but I still cannot actually invoke the builtin without flakes.

    I'm not sure whether #15654 addresses this specific example or not?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationidea approved

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions