Skip to content

[Feature Request] Post-fetch hooks #145

@bandithedoge

Description

@bandithedoge

While the extract option can help avoid IFD in some cases, a lot of the time one needs to use an extra program on the extracted files before being usable. For example, to properly package a Zig project with external dependencies, a tool like zon2nix must be used to turn build.zig.zon to something Nix can understand.

I propose adding a new option named, say, post_fetch, which defines a shell command to be run after nvfetcher finishes fetching the new file and extracting files specified in extract. Here's an example of what this would look like:

[river]
src.git = "https://codeberg.org/river/river.git"
fetch.git = "https://codeberg.org/river/river.git"
extract = ["build.zig.zon"]
post_fetch = "nix run nixpkgs#zon2nix -- $src/build.zig.zon > deps.nix"

The script would run in _sources/ and have the path to the right sha256-... directory with extracted files passed to it as $src. We can then read this ./_sources/deps.nix file in our Nix expression without IFD.

A solution like this would serve as a great workaround for platforms that aren't implemented in nvfetcher like Rust is. What are your thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions