# Use cabal2nix to create derivation from cabal test target?

**URL:** <https://discourse.haskell.org/t/use-cabal2nix-to-create-derivation-from-cabal-test-target/9400>\
**Category:** Uncategorized\
**Created:** [April 23, 2024, 11:08pm UTC](https://discourse.haskell.org/t/use-cabal2nix-to-create-derivation-from-cabal-test-target/9400 "2024-04-23T23:08:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![hippoid](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/hippoid/32/2039_2.png) [@hippoid](https://discourse.haskell.org/u/hippoid)\
**Post date:** [April 23, 2024, 11:08pm UTC](https://discourse.haskell.org/t/use-cabal2nix-to-create-derivation-from-cabal-test-target/9400/1 "2024-04-23T23:08:33Z")

</div>

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.

```haskell
{
  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](https://github.com/idrisr/cabal2nix-question). You should be able to clone it and have a working example. Thanks in advance!
