nix-prefetch icon indicating copy to clipboard operation
nix-prefetch copied to clipboard

Add flake support

Open terlar opened this issue 3 years ago • 3 comments

Currently when trying to use nix-prefetch with something that requires flakes it will fail, it is testing for flake but only adds --experimental-features nix-command: https://github.com/msteen/nix-prefetch/blob/master/src/main.sh#L163

I have a flake that provides a packages that is using fixed output hashes (go-modules vendor stuff). I would like to do something like:

nix-prefetch '{ sha256 }: (builtins.getFlake (toString ./.)).packages.x86_64-linux.terraform-provider-aws.go-modules.overrideAttrs (_: { vendorSha256 = sha256; })'

This commands will refuse to evaluate due to flakes feature not being enabled.

Would it make sense to add this, or is it possible to provide extra flags to the nix command via the nix-prefetch CLI?

terlar avatar Feb 20 '22 22:02 terlar

@terlar #34 should fix this issue.

ShamrockLee avatar Apr 20 '22 11:04 ShamrockLee

... or is it possible to provide extra flags to the nix command via the nix-prefetch CLI?

It is, nix-prefetch --option extra-experimental-features flakes works fine.

Shados avatar Aug 13 '23 02:08 Shados

I tried using this:

nix-prefetch --option extra-experimental-features flakes '{ sha256 }: (builtins.getFlake (toString ./.)).packages.x86_64-linux.node.go-modules.overrideAttrs (_: { vendorSha256 = sha256; })'

With the fake in this repo: https://github.com/status-im/go-waku

But I get no output. This is what I get with -vv:

 > nix-prefetch -vv '{ sha256 }: (builtins.getFlake (toString ./.)).packages.x86_64-linux.node.go-modules.overrideAttrs (_: { vendorSha256 = sha256; })' 
The following Bash variables have been set:
> file='<nixpkgs>'
> expr='{ sha256 }: (builtins.getFlake (toString ./.)).packages.x86_64-linux.node.go-modules.overrideAttrs (_: { vendorSha256 = sha256; })'
> fetchurl=0
> force_https=1
> input_type=''
> output_type=raw
> print_path=0
> print_urls=0
> compute_hash=1
> check_store=0
> silent=0
> quiet=0
> verbose=1
> debug=1
> eval=''
> autocomplete=0
> help=0

The following Nix function call will be evaluated:
> prefetch {
> 

I have no idea what that means.

jakubgs avatar Nov 08 '23 06:11 jakubgs