Using a .tar.gz file which only contains a file with builtins.fetchTarball results in a derivation that is an empty directory.
This behaviour is inconsistent with nix-prefetch-url --unpack which is often cited as the recommended way to obtain sha256 for these fixed output derivations.
Steps To Reproduce
let
dotslashPath = builtins.fetchTarball {
url = "https://github.com/facebook/dotslash/releases/download/v0.4.1/dotslash-macos.v0.4.1.tar.gz";
};
in
dotslashPath
❯ nix-instantiate --eval ./testing.nix
"/nix/store/0ccnxa25whszw7mgbgyzdm4nqc0zwnm8-source"
❯ file /nix/store/0ccnxa25whszw7mgbgyzdm4nqc0zwnm8-source
/nix/store/0ccnxa25whszw7mgbgyzdm4nqc0zwnm8-source: directory
❯ ls -l /nix/store/0ccnxa25whszw7mgbgyzdm4nqc0zwnm8-source
total 0
Expected behavior
The documentation states that the top-level directory will be removed, but does not specify what happens when there is no top-level directory.
4785 suggests that prior to a certain Nix release the file would have been extracted successfully. Looking back at a past release may help to inform what should happen.
My personal preference is that fetching of a single-file tarball would work, and that the filename be perserved (this does not happen with nix-prefetch-url --unpack, the file ends up being placed at the store path itself). If that is not possible, a clear error.
Describe the bug
Using a
.tar.gz
file which only contains a file withbuiltins.fetchTarball
results in a derivation that is an empty directory.This behaviour is inconsistent with
nix-prefetch-url --unpack
which is often cited as the recommended way to obtainsha256
for these fixed output derivations.Steps To Reproduce
Expected behavior
The documentation states that the top-level directory will be removed, but does not specify what happens when there is no top-level directory.
4785 suggests that prior to a certain Nix release the file would have been extracted successfully. Looking back at a past release may help to inform what should happen.
My personal preference is that fetching of a single-file tarball would work, and that the filename be perserved (this does not happen with
nix-prefetch-url --unpack
, the file ends up being placed at the store path itself). If that is not possible, a clear error.nix-env --version
outputnix-env (Nix) 2.23.0
Additional context
Similar expected behaviour ambiguity to #4785
Priorities
Add :+1: to issues you find important.