nixd icon indicating copy to clipboard operation
nixd copied to clipboard

nixd: url prefetching

Open inclyc opened this issue 1 year ago • 4 comments

Provide URL prefetchers. Automatically fill hash section.

fetchurl {

}

inclyc avatar Apr 25 '24 06:04 inclyc

Should this feature be implemented as a "code action" that requires manual triggering? The files to be downloaded may be quite large.

Origami404 avatar Jun 23 '24 12:06 Origami404

Should this feature be implemented as a "code action" that requires manual triggering? The files to be downloaded may be quite large.

Yes. I'd like to do this in Code Lens, with workspace/executeCommand

inclyc avatar Jun 23 '24 12:06 inclyc

https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_codeLens

inclyc avatar Jun 23 '24 12:06 inclyc

@MangoIV https://github.com/nix-community/nixd/issues/536#issue-2375239352

offer to augment the passed attribute set with the hash computed from prefetching it.

Note that things like fetchFromGithub are actually FODs, not just "fetchers", and require some evaluation. I'm currently on design-review about how to balance between evaluation and fetching by idioms.

I also searched nixpkgs and see there are quite some expressions like:

fetchFromGitHub {
  rev = "v${version}";
}

And thus "version" needs to be evaluated. And...

finalAttrs.version may needs some cross-file analysis.

inclyc avatar Jun 26 '24 15:06 inclyc