title: How do you build an executable from haskell packages (which use stack / cabal) in nix?
body: <p>I'm looking for something similar to this:</p>
  <p><code>shell.nix</code></p>
  <pre><code>{ pkgs ? import &lt;nixpkgs&gt; {} }:
  let
    threadscope = ...
    speedscope = ...
  in
    stdenv.mkDerivation {
      name = &quot;haskell-env&quot;;
      nativeBuildInputs = [
        # Haskell tools
        ghcid ghc
  
        # Profiling tools
        threadscope
        speedscope
      ];
    }
  </code></pre>
  <p>Then I can use <code>nix-shell</code>:</p>
  <pre><code>% nix-shell
  ...
  nix-shell % threadscope &lt;some-commands&gt;
  nix-shell % speedscope &lt;some-commands&gt;
  </code></pre>
  <p>Do you usually just build from source from github / hackage / stackage or use <code>pkgs.haskellPackages.&lt;my-package&gt;</code>?</p>