srid / srid/haskell-flake

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

Open
#95 2 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Nix
Stars
240
Forks
27
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by examining the flake outputs and package definitions around callCabal2nix, then review nixpkgs' lib.lazyDerivation reference linked in the issue. Determine the output names and unconditional attributes that must remain available without import-from-derivation. Done means the flake can be shown with allow-import-from-derivation set to false, including multi-output packages.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
build-system
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.