Skip to content

OUT_PATHS empty in post-build-hook in Nix 2.8.0 #6446

@arobertn

Description

@arobertn

Describe the bug

As the title says, post-build-hook will be run with OUTPUT_PATHS set but empty after a successful nix build. DRV_PATH is set non-empty.

Steps To Reproduce

We observed this in an unchanged GitHub CI setup with Cachix install-nix-action once it updated from 2.7.0 to 2.8.0. With 2.8.0 installed, you can see the bug by, setting a simple build-hook script, e.g. "build-hook.sh":

#!/usr/bin/env bash

set -euf 

echo "post-build-hook"
echo "-- ${OUT_PATHS} --"
echo "^^ ${DRV_PATH} ^^"

and then running one of:

nix-build -E '(import <nixpkgs> {}).writeText "example" (builtins.toString builtins.currentTime)' --post-build-hook ./build-hook.sh

or

nix build --rebuild -L nixpkgs#hello --extra-experimental-features flakes --post-build-hook ./build-hook.sh

Results look like:

post-build-hook: post-build-hook
post-build-hook: --  --
post-build-hook: ^^ /nix/store/5fv6808114kqw4n8g5qn8pczzfw7mrl4-example.drv ^^

Where the OUTPUT_PATHS line unexpectedly has an empty value.

nix-env --version output

% nix-env --version
nix-env (Nix) 2.8.0

Additional context

First commented here in #5694 but this seems to be a different issue. #6311 may be related.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions