I use this default.nix
to build my package with nix-build
and get the env
with nix-shell
{ pkgs ? import <nixpkgs> {} }:
with pkgs;
with haskellPackages;
let
myPackage = callPackage ./myPackage.nix {};
in
if lib.inNixShell then myPackage.env else myPackage
myPackage.nix
generated using cabal2nix . > myPackage.nix
{ mkDerivation, base, split, stdenv }:
mkDerivation {
pname = "myPackage";
version = "0.1.0.0";
src = ./.;
isLibrary = false;
isExecutable = true;
executableHaskellDepends = [ base split ];
license = stdenv.lib.licenses.bsd3;
}
This working fine for building but I want to add development helper tools while I working on it. I don't want to edit myPackage.nix
. I want to re-run cabal2nix
when I edit myPackage.cabal
.
I try to use buildInputs
of mkDerivation
but did not seem to work.
let
myPackage = callPackage ./myPackage.nix {};
in
stdenv.mkDerivation {
name = myPackage.name;
buildInputs = [ myPackage hlint hasktags ];
}
Beside nix-build
stop working, it also drop me in the shell with executable of myPackage
but without myPackage
's env.
I know this because ghc
is not avaliable while it exists in myPackage
's env when using default.nix
above.
How can I add those tools to env
generated from cabal2nix
?