Clash-protocols fails to build

I followed the documentation of clash-protocols but when I try to add it as dependency I get:

% nix log /nix/store/p1r6jx75y3d4qbpdma4d5a0z5n4ywzqn-clash-protocols-0.1.drv
Running phase: setupCompilerEnvironmentPhase
@nix { "action": "setPhase", "phase": "setupCompilerEnvironmentPhase" }
Build with /nix/store/xva1k28a3vq0lkzf9f6q43krfq1lnmgr-ghc-9.10.3.
Running phase: unpackPhase
@nix { "action": "setPhase", "phase": "unpackPhase" }
unpacking source archive /nix/store/648pxjdhwwcjk7d7037k5kqbxasylb6c-clash-protocols
source root is clash-protocols
Running phase: patchPhase
@nix { "action": "setPhase", "phase": "patchPhase" }
Running phase: compileBuildDriverPhase
@nix { "action": "setPhase", "phase": "compileBuildDriverPhase" }
setupCompileFlags: -package-db=/build/tmp.pJORXkEpnB/setup-package.conf.d -threaded
[1 of 2] Compiling Main             ( Setup.hs, /build/tmp.pJORXkEpnB/Main.o )
[2 of 2] Linking Setup
Running phase: updateAutotoolsGnuConfigScriptsPhase
@nix { "action": "setPhase", "phase": "updateAutotoolsGnuConfigScriptsPhase" }
Running phase: configurePhase
@nix { "action": "setPhase", "phase": "configurePhase" }
configureFlags: --verbose --prefix=/nix/store/6rg65l43ic0z2kgz5vczr55ps77anhxg-clash-protocols-0.1 --libdir=$prefix/lib/$compiler/lib --libsubdir=$abi/$libname --datadir=/nix/store/3mf2pyas>
Using Parsec parser
Configuring clash-protocols-0.1...
Error: [Cabal-8010]
Encountered missing or private dependencies:
    data-default >=0.7.1.1 && <0.8
CallStack (from HasCallStack):
  dieWithException, called at libraries/Cabal/Cabal/src/Distribution/Simple/Configure.hs:1457:11 in Cabal-3.12.1.0-7e3b:Distribution.Simple.Configure

I’m stuck what I’m doing wrong.

{
  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-25.11";
    flake-parts.url = "github:hercules-ci/flake-parts";
    haskell-flake.url = "github:srid/haskell-flake";
    clash-compiler.url = "github:clash-lang/clash-compiler";
    clash-protocols = {
      url = "github:clash-lang/clash-protocols";
      inputs.clash-compiler.follows = "clash-compiler";
    };
  };
  outputs = inputs@{ self, nixpkgs, flake-parts, haskell-flake, clash-compiler, clash-protocols }:
    flake-parts.lib.mkFlake { inherit inputs; } {
      systems = nixpkgs.lib.systems.flakeExposed;
      imports = [ haskell-flake.flakeModule ];

      perSystem = { self', system, ... }:
        let
          compiler-version = "ghc9103";
          pkgs = (import clash-compiler.inputs.nixpkgs {
            inherit system;
          }).extend clash-compiler.overlays.${compiler-version};
          clash-pkgs = pkgs."clashPackages-${compiler-version}";
          overlay = final: prev: {
            mypackage = prev.developPackage {
              root = ./.;
              overrides = _: _: final;
            };
          } // clash-protocols.overlays.${system}.default final prev;
          hs-pkgs = clash-pkgs.extend overlay;
          hdl = "verilog";
        in
          {
            devShells.default = hs-pkgs.shellFor {
              packages = p: [
                p.mypackage
              ];
              nativeBuildInputs = [
                hs-pkgs.cabal-install
                hs-pkgs.cabal-plan
                hs-pkgs.fourmolu
                hs-pkgs.haskell-language-server
              ];
            };

            packages.default = hs-pkgs.mypackage;
          };
    };
}

Above is my flake.nix.

Sorry to hear you had this experience. You did nothing wrong!

What happened is that we recently updated clash-compiler to use new dependencies. But clash-protocols is not updated yet. Which led to the problem you are seeing.

I have updated clash-protocols: Update flake by rowanG077 · Pull Request #194 · clash-lang/clash-protocols · GitHub which should be merged very soon.

In the meantime it is probably easiest for you to pin clash-protocols to the update commit from that PR like so:

    clash-protocols = {
      url = "github:clash-lang/clash-protocols/296780ad550e1a7532cbace48e37b83534ec42a3";
      inputs.clash-compiler.follows = "clash-compiler";
    };

Note the /296780ad550e1a7532cbace48e37b83534ec42a3 at the end of the clash-protocols url

1 Like