flakehub-push icon indicating copy to clipboard operation
flakehub-push copied to clipboard

Publish fails when a flake's outputs uses IFD / import-from-derivation

Open ipetkov opened this issue 1 year ago • 2 comments

Error

https://github.com/ipetkov/crane/actions/runs/12098492773/job/33735063127

Error: 
   0: failed to evaluate all system attrs of the flake
   1: Failed to execute command `nix flake show --all-systems --json --no-write-lock-file /nix/store/sbcvc2f9ys9j92nvxvscb6wqmghs0511-source` with status 1 
      stdout: 
      stderr: evaluating ''...
      unpacking 'https://github.com/NixOS/nixpkgs/archive/5083ec887760adfe12af64830a66807423a859a7.tar.gz' into the Git cache...
      unpacking 'https://github.com/oxalica/rust-overlay/archive/0be641045af6d8666c11c2c40e45ffc9667839b5.tar.gz' into the Git cache...
      evaluating 'checks'...
      evaluating 'checks.aarch64-darwin'...
      evaluating 'checks.aarch64-darwin.bzip2Sys'...
      evaluating 'checks.aarch64-darwin.cargoAuditTests'...
      evaluating 'checks.aarch64-darwin.cargoClippyThenBuild'...
      evaluating 'checks.aarch64-darwin.cargoDenyTests'...
      evaluating 'checks.aarch64-darwin.cargoFmt'...
      evaluating 'checks.aarch64-darwin.cargoFmtThenClippy'...
      evaluating 'checks.aarch64-darwin.cargoLlvmCov'...
      evaluating 'checks.aarch64-darwin.cargoLockOverride'...
      evaluating 'checks.aarch64-darwin.chainedMultiple'...
      evaluating 'checks.aarch64-darwin.cleanCargoTomlTests'...
      evaluating 'checks.aarch64-darwin.clippy'...
      evaluating 'checks.aarch64-darwin.codesign'...
      evaluating 'checks.aarch64-darwin.compilesFreshOverlappingTargets'...
      evaluating 'checks.aarch64-darwin.compilesFreshSimple'...
      evaluating 'checks.aarch64-darwin.compilesFreshSimpleBuildPackage'...
      evaluating 'checks.aarch64-darwin.compilesFreshWithBuildScript'...
      evaluating 'checks.aarch64-darwin.compilesFreshWithBuildScriptCustom'...
      evaluating 'checks.aarch64-darwin.compilesFreshWithCustomTargetDir'...
      evaluating 'checks.aarch64-darwin.compilesFreshWorkspace'...
      evaluating 'checks.aarch64-darwin.craneUtilsChecks'...
      evaluating 'checks.aarch64-darwin.cratePatching'...
      evaluating 'checks.aarch64-darwin.customCargoTargetDirectory'...
      evaluating 'checks.aarch64-darwin.customDummy'...
      error:
             … while evaluating a branch condition
               at /nix/store/n1g84klfb0h3bpwyvc59lcy5ca58h36w-source/lib/strings.nix:2627:3:
               2626|   # First detect the common case of already valid strings, to speed those up
               2627|   if stringLength string <= 207 && okRegex string != null
                   |   ^
               2628|   then unsafeDiscardStringContext string

             … in the left operand of the AND (&&) operator
               at /nix/store/n1g84klfb0h3bpwyvc59lcy5ca58h36w-source/lib/strings.nix:2627:33:
               2626|   # First detect the common case of already valid strings, to speed those up
               2627|   if stringLength string <= 207 && okRegex string != null
                   |                                 ^
               2628|   then unsafeDiscardStringContext string

             (stack trace truncated; use '--show-trace' to show the full, detailed trace)

             error: cannot build '/nix/store/vkavpsq0x1jsd4wbadpb8rkl8yf79amz-custom-dummy-0.0.0.drv^out' during evaluation because the option 'allow-import-from-derivation' is disabled


Metadata

key value
version 0.1.0
os linux
arch x86_64
2024-11-30T18:16:06.7878535Z

ipetkov avatar Nov 30 '24 18:11 ipetkov

Sounds like IFD is not allowed on FlakeHub (#69). Was IFD added somewhere since the last successful action run?

simonzkl avatar Jan 12 '25 10:01 simonzkl

Probably, though if that's the case the UX around this type of error is sorely lacking. Flakes enable IFD by default, I shouldn't have to dig through a huge error trace and then this here issue log to find out that's the case (perhaps the publish should gracefully fallback to not populating the flake's outputs)

ipetkov avatar Jan 14 '25 23:01 ipetkov