haskell-flake icon indicating copy to clipboard operation
haskell-flake copied to clipboard

Support `nix flake show --option allow-import-from-derivation false`

Open roberth opened this issue 1 year ago • 2 comments

This will allow inclusion of haskell-flake based projects into the NixOS flakes search.

I believe it can be done, but we'll have to make the set of attributes less dynamic, in particular we have to predict outputs, the names of the outputs.

lib.lazyDerivation https://github.com/NixOS/nixpkgs/commit/fce8b018f06431e7684b725a520416ff3862db9f produces an attrset that is a valid "derivation attrset" but only needs to evaluate the argument derivation for attributes that really need it, like drvPath, outPath, etc.

Our package definitions would have to look somewhat like

fix (pkg:
  lazyDerivation {
    derivation = callCabal2nix ...;
    meta = ... hardcoded or perhaps some `readFile` on `.cabal` sources if we dare ...;
    passthru = {
      inherit (pkg)
        overrideCabal
        overrideAttrs
        # ... any useful unconditional attributes
        ;
    };
  }
)

I can add multi-output support to lazyDerivation.

roberth avatar Feb 26 '23 10:02 roberth

This would be good to have (though nix flake show would still not work if systems has other platforms).

I can add multi-output support to lazyDerivation.

Not sure what this means?

srid avatar Feb 27 '23 14:02 srid

though nix flake show would still not work if systems has other platforms

Why wouldn't it? The goal is to remove IFD from the attribute paths queried by that command. That should be sufficient to make it work for any system.

I can add multi-output support to lazyDerivation.

It doesn't handle derivations with multiple outputs correctly. Haskell packages do use multiple outputs by default, so I guess this issue is blocked on this.

roberth avatar Feb 27 '23 19:02 roberth