Skip to content

nix build fails on components which use ghc plugins #2096

Closed
@spacekitteh

Description

@spacekitteh

While trying to build any of my libraries (or any packages which depend on those libraries) which use GHC plugins, I get the following error:

       > Error: Setup: '/build/tmp.usjCQn4s88/bin/ghc' exited with an error:
       > <command line>: Could not load module ‘Polysemy.Plugin’
       > It is a member of the hidden package ‘polysemy-plugin-0.4.5.1’.
       > Perhaps you need to add ‘polysemy-plugin’ to the build-depends in your .cabal
       > file.
       > Use -v (or `:set -v` in ghci) to see a list of the files searched for.

I obviously have it in the build-depends in the cabal file. The .cabal file looks like this:

cabal-version:      3.4
-- The cabal-version field refers to the version of the .cabal specification,
-- and can be different from the cabal-install (the tool) version and the
-- Cabal (the library) version you are using. As such, the Cabal (the library)
-- version used must be equal or greater than the version stated in this field.
-- Starting from the specification version 2.2, the cabal-version field must be
-- the first thing in the cabal file.

-- Initial package description 'cosmic-modelling' generated by
-- 'cabal init'. For further documentation, see:
--   http://haskell.org/cabal/users-guide/
--
-- The name of the package.
name:               cosmic-modelling

-- The package version.
-- See the Haskell package versioning policy (PVP) for standards
-- guiding when and how versions should be incremented.
-- https://pvp.haskell.org
-- PVP summary:     +-+------- breaking API changes
--                  | | +----- non-breaking API additions
--                  | | | +--- code changes with no API change
version:            0.1.0.0

-- A short (one-line) description of the package.
synopsis:           Domain modelling tools based on `polysemy-methodology`

-- A longer description of the package.
-- description:

-- The license under which the package is released.
license:            AGPL-3.0-or-later

-- The file containing the license text.
license-file:       LICENSE

-- The package author(s).
author:             Sophie Taylor

-- An email address to which users can send suggestions, bug reports, and patches.
maintainer:         sophie@spacekitteh.moe

-- A copyright notice.
-- copyright:
category:           Development
build-type:         Simple

-- Extra doc files to be distributed with the package, such as a CHANGELOG or a README.
extra-doc-files:    CHANGELOG.md

-- Extra source files to be distributed with the package, such as examples, or a tutorial module.
-- extra-source-files:

common commonStuff
 default-extensions: GADTs, TemplateHaskell, LambdaCase, DeriveGeneric, DeriveAnyClass, LinearTypes,
                     FlexibleContexts, BlockArguments, RecordWildCards, ScopedTypeVariables, DataKinds, KindSignatures, DerivingStrategies, DerivingVia, StandaloneDeriving, MultiParamTypeClasses, TypeApplications,
                     RankNTypes, PolyKinds, AllowAmbiguousTypes, TypeFamilies, FlexibleInstances, FunctionalDependencies, ApplicativeDo, NoFieldSelectors, TypeOperators, OverloadedStrings, ConstraintKinds, DeriveDataTypeable, 
                     UndecidableInstances, DeriveFunctor, DeriveFoldable, DeriveTraversable, MultiWayIf, ViewPatterns,
                     OverloadedLabels, QualifiedDo, RoleAnnotations, TupleSections, QuantifiedConstraints, BangPatterns, UnliftedDatatypes, DeriveLift, QuasiQuotes
 ghc-options: -Wall -fplugin=Polysemy.Plugin
 build-depends: base,polysemy, polysemy-plugin, polysemy-methodology, polysemy-process >= 0.12, polysemy-zoo

library
    import:           commonStuff

    -- Modules exported by the library.
    exposed-modules:  Development.DomainModelling

    -- Modules included in this library but not exported.
    -- other-modules:

    -- LANGUAGE extensions used by modules in this package.
    -- other-extensions:

    -- Other library packages from which modules are imported.
    -- build-depends: 

    -- Directories containing source files.
    hs-source-dirs:   lib

    -- Base language which the package is written in.
    default-language: GHC2021

test-suite cosmic-modelling-test
    import:           commonStuff

    -- Base language which the package is written in.
    default-language: GHC2021

    -- Modules included in this executable, other than Main.
    -- other-modules:

    -- LANGUAGE extensions used by modules in this package.
    -- other-extensions:

    -- The interface type and version of the test suite.
    type:             exitcode-stdio-1.0

    -- Directories containing source files.
    hs-source-dirs:   test

    -- The entrypoint to the test suite.
    main-is:          Main.hs

    -- Test dependencies.
    build-depends:    cosmic-modelling

If I enter a shell with nix develop, and then cabal build, it compiles just fine.

Haskell.nix version: 66191df
GHC version(s): 9.6.2, 9.6.3
NixOS, x86_64-linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions