I’m trying to import a package built by one (local) flake in another. I actually don’t want to have to have it locked, so I’m trying to import it directly. I tried with callPackage, but was told that flake-compat’s default.nix produces derivation directly.
trace: /nix/store/pvc2z2jz7p6il74z7dx4p1q4fwia43xg-aws-bootstrap
error: Dependency is not of a valid type: element 3 of buildInputs for nix-shell
(use '--show-trace' to show detailed location information)
Seems like (import ./utils/aws-bootstrap/default.nix) is a path to the source code. It does not have any default key, neither it (or contains) any derivation. How? Why? I am confused why would I get such a different results between my flake and nix repl executed in the same directory.
The reason the trace is a path, is that ''${foo}'' (quoting and then antiquoting) implicitly converts packages to their output paths.
The flake-compat layer creates the default attribute, see here. I’m not sure why it does that, but presumably nix-build expects either a derivation or an attribute set with a default parameter which is the derivation to build.
You have to put a .default somewhere, either in the default.nix itself or in the flake.nix where you import the default.nix.
Also for future reference, if you have a problem involving multiple files, it’s helpful if you put them in a publicly accessible git repository so other people can reproduce the problem and poke around the code.
Wait actually I’ve contradicted myself here. If ''${imp}'' is printing a store path, then it should be a derivation, not a {default = <derivation>;} attrset.