Skip to content

runCommand fails when using __structuredAttrs #213641

@lunik1

Description

@lunik1

Describe the bug

The trivial runCommand builder (and friends) fails on a trivial derivation when __structuredAttrs is set.

Steps To Reproduce

Steps to reproduce the behaviour:

  1. Build the following derivation:
runCommand "foo" {__structuredAttrs = true;} ''. .attrs.sh; mkdir ''${outputs[out]}''

and get this error

error: builder for '/nix/store/vj7a0vhacspbvfjyngqf12iq8gj9vagz-foo.drv' failed with exit code 1;
       last 1 log lines:
       > /nix/store/9krlzvny65gdc8s7kpb6lkx8cd02c25b-default-builder.sh: line 1: /setup: No such file or directory
       For full logs, run 'nix log /nix/store/vj7a0vhacspbvfjyngqf12iq8gj9vagz-foo.drv'.

Expected behavior

Derivation should build, akin to

runCommand "foo" {} ''mkdir $out''

Additional context

There is a partial workaround seen here where builder is set instead of buildCommand, however this leaves the utility functions defined in setup.sh unavailable to the builder.

Notify maintainers

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
output here

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions