srid / haskell-flake

A `flake-parts` Nix module for Haskell development
https://community.flake.parts/haskell-flake
MIT License
128 stars 14 forks source link

`buildFromSdist` fails with Rust packages #292

Closed srid closed 3 months ago

srid commented 3 months ago

The haskell package set can contain non-Haskell packages, like Rust libraries. These are currently set using custom option (but see #285) for better way, which is applied as the last option, but before buildFromSdist. Thus, buildFromSdist (because it is enabled by default since #286) will evaluate on these non-Haskell packages as well.

$ nix build github:shivaraj-bh/haskell-rust-ffi-template --override-input haskell-flake github:srid/haskell-flake/51bcbc27194e734a1524ac3d36e1539fba9a3baa
[..]
        at /nix/store/fjvkr94j3lwca8y66zccn15rjwzqn0rd-source/pkgs/development/haskell-modules/lib/compose.nix:308:25:

          307|    */
          308|   buildFromSdist = pkg: overrideCabal (drv: {
             |                         ^
          309|     src = "${sdistTarball pkg}/${pkg.pname}-${pkg.version}.tar.gz";

       … while calling 'overrideCabal'

         at /nix/store/fjvkr94j3lwca8y66zccn15rjwzqn0rd-source/pkgs/development/haskell-modules/lib/compose.nix:38:22:

           37|    */
           38|   overrideCabal = f: drv: (drv.override (args: args // {
             |                      ^
           39|     mkDerivation = drv: (args.mkDerivation drv).override f;

       error: attribute 'override' missing

       at /nix/store/fjvkr94j3lwca8y66zccn15rjwzqn0rd-source/pkgs/development/haskell-modules/lib/compose.nix:38:28:

           37|    */
           38|   overrideCabal = f: drv: (drv.override (args: args // {
             |                            ^
           39|     mkDerivation = drv: (args.mkDerivation drv).override f;
shivaraj-bh commented 3 months ago

shouldn’t making buildFromSdist = true a setting for packages local.toCurrentProject solve it?

srid commented 3 months ago

shouldn’t making buildFromSdist = true a setting for packages local.toCurrentProject solve it?

Yup, that's what I was going to try next (see https://github.com/srid/haskell-flake/pull/291#issuecomment-2033350702). But the whole day instead was spent trying to find reliable internet connection 🙃