Include nix flakes output in another flake

Hello,

I have a flake input (defined with haskell.nix), I’d like to embed in a docker container.

While, build it directly works:

nix build -L '.#packages.x86_64-linux.cabal-audit-static'

When I try to embed it;

# SPDX-FileCopyrightText: (C) Gautier DI FOLCO <gautier.difolco@gmail.com>
# SPDX-License-Identifier: ISC
{
  description = "A Nix Flake for haskell-security-action";
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    flake-utils.url = "github:numtide/flake-utils";
    cabal-audit.url = "github:mangoiv/cabal-audit";
  };

  outputs = { self, ... }@inputs:
    let
      supportedSystems = with inputs.flake-utils.lib.system;
        [
          x86_64-linux
          #x86_64-darwin
          #aarch64-linux
          #aarch64-darwin
        ];
    in inputs.flake-utils.lib.eachSystem supportedSystems (system:
      let pkgs = import inputs.nixpkgs { inherit system; };
      in rec {
        packages.github-action-scan-image = pkgs.dockerTools.buildImage {
          name = "blackheaven/haskell-security-action";
          tag = "latest";

          copyToRoot = pkgs.buildEnv {
            name = "image-root";
            paths =
              [ inputs.cabal-audit.packages.${system}.cabal-audit-static ];
            pathsToLink = [ "/bin" ];
          };
          config = { Cmd = [ "/bin/only-for-file-transfer" ]; };
        };

        defaultPackage = packages.github-action-scan-image;

        devShell = pkgs.mkShell { };
      });
}

It fails, as it tried to use my nixpkgs:

$ nix build -L
error:
       … while calling the 'derivationStrict' builtin

         at /builtin/derivation.nix:9:12: (source not available)

       … while evaluating derivation 'cabal-audit-static-x86_64-unknown-linux-musl-1.0.0.0'
         whose name attribute is located at /nix/store/h1v7aq3k9wy0i5l53cirm7kka7fsipji-source/pkgs/stdenv/generic/make-derivation.nix:336:7

       … while evaluating attribute 'propagatedBuildInputs' of derivation 'cabal-audit-static-x86_64-unknown-linux-musl-1.0.0.0'

         at /nix/store/h1v7aq3k9wy0i5l53cirm7kka7fsipji-source/pkgs/stdenv/generic/make-derivation.nix:390:7:

          389|       depsHostHostPropagated      = elemAt (elemAt propagatedDependencies 1) 0;
          390|       propagatedBuildInputs       = elemAt (elemAt propagatedDependencies 1) 1;
             |       ^
          391|       depsTargetTargetPropagated  = elemAt (elemAt propagatedDependencies 2) 0;

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

       error: attribute 'typst_0_5_0_3' missing

       at /nix/store/h4vhpfsw6rbpclppr1bpk5l2hmjmpyp1-source/nix/haskell-overlay.nix:15:11:

           14|   sel = hlib.doJailbreak (hlib.markUnbroken hprev.sel);
           15|   typst = hprev.typst_0_5_0_3;
             |           ^
           16|   typst-symbols = hprev.typst-symbols_0_1_6;
       Did you mean typst_0_5_0_5?

How can I simply embeds another input’s output, with it’s inputs, not mine?

Thanks in advance.