I’ve posted this on the nixos-discourse, but also trying here to see if I can solicit a response.
I’m trying to create a derivation for the test target of cabal based haskell project. I’m able to use cabal2nix
to create a derivation from the executable target. I can’t figure out how to do it for the test target.
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/23.11";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { nixpkgs, flake-utils, ... }:
let
system = flake-utils.lib.system.x86_64-linux;
compiler = "ghc948";
pkgs = nixpkgs.legacyPackages.${system};
my-haskell-exe =
pkgs.haskell.packages."${compiler}".callCabal2nix "what-goes-here?"
./my-haskell-project { };
# my-haskell-test = how to make a derivation from the cabal test target?;
in {
packages.${system}.default = my-haskell-exe;
checks.${system}.default = my-haskell-exe;
};
}
Here’s what I have so far in the flake. Also here’s a full minimal example with a simple cabal haskell project included: GitHub - idrisr/cabal2nix-question . You should be able to clone it and have a working example. Thanks in advance!