devour-flake
devour-flake copied to clipboard
Allow supporting nix-build-uncached
The current devour-flake build script is hostile to performing incremental CI builds because building the top level derivation requires fully downloading all derivations from the flake (if there are many such derivations or their artifacts are large, the CI is going to waste cycles and bandwidth downloading artifacts from the cache).
A better approach would be for the script to still evaluate the all-encompassing-derivation but instead of building it directly, it should output only the input derivations. Then the caller can do whatever they want with those actual derivations (pass them to nix build or nix-build-uncached etc.).
For example:
FLAKE="$1"
shift 1 || true
nix derivation show ${./.}#default \
"$@" \
--override-input flake "$FLAKE" \ |
jq 'to_entries[].value.inputDrvs | to_entries[].key'