Is it possible to disable the automatic unpacking of Nix Flake inputs?
For example, say we have the following flake.nix which depends on a non-flake tarball:
{
inputs = {
tarball = {
url = "https://some.tar.zst";
flake = false;
};
};
outputs = { self, tarball }: {
# I would like tarball to remain how it was downloaded, so no unpacking.
}
}
Thanks, it’s similar to that issue but what I’m specifically looking for is something like:
{
inputs = {
tarball = {
url = "https://some.tar.zst";
flake = false;
unpack = false; # <--- disables the automatic unpacking of inputs
name = "some.tar.zst" # <--- uses a proper name instead of /nix/store/...-source
};
};
outputs = { self, tarball }: {
# tarball now refers to the downloaded tarball in the nix store with the specified name like:
# /nix/store/...-some.tar.zst
}
}
file: Plain files or directory tarballs, either over http(s) or from the local disk.In URL form, the schema must be file+http://, file+https:// or file+file://. If the extension doesn’t correspond to a known archive format (as defined by the tarball fetcher), then the file+ prefix can be dropped.
So in this case you want to avoid dropping the file+ before https:
This would name the derivations according to the flake input name in your case it would be (-tarball-source) because your input is .input.tarball.
I think the underlying reason for the existing behaviour is that this fetchTree call isn’t passed a name attribute.
The downside is that a nix upgrade making this change would cause all existing flake builds (relying on a flake input) to become subsitution misses, since it changes the source inputs in the derivation.