Skip to content

Add a --tree cli flag for evaluating a Nix file from an arbitrary fetchTree URL #10047

Open

Description

@thufschmitt

One of the killer features of flakes is Flakerefs which allow to directly refer to a – potentially remote – Nix expression from the command-line very concisely (nix run nixpkgs#hello).
Most of that is however not flake-specific, but just pertains to the fetchers infrastructure which gives this URL-ish syntax for accessing remote resources1.
We can easily bring that to old-style Nix expressions with a new CLI syntax --tree <treeRef>#attr.path that would be morally equivalent to --file $(nix flake prefetch <treeRef>) attr.path.

We can then remove the NIX_PATH=flake:<flakeref> hack as it won't be needed any more (removing it is OK because although it's exposed to the old CLI, it depends on Flakes to be enabled).

Footnotes

  1. There is actually a hack that allows having flake:<flakeref> in NIX_PATH to fetch a remote fetcher ref from the network without really using flakes ↩

Activity

  1. added
    feature
    cli
    idea approved
    on Feb 20, 2024
  2. nixos-discourse commented on Feb 26, 2024

    @nixos-discourse
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

    clifeatureidea approved

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions