Skip to content

Instantly share code, notes, and snippets.

@ddellacosta
Created March 15, 2019 16:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ddellacosta/f98ff02058a4d58aaae15aba523bb21c to your computer and use it in GitHub Desktop.
Save ddellacosta/f98ff02058a4d58aaae15aba523bb21c to your computer and use it in GitHub Desktop.
how else would I ensure cabal and cabal2nix are loaded in the shell on a project-specific basis?
{ nixpkgs ? import ./pinned.nix {}, compiler ? "ghc863" }:
let
inherit (nixpkgs) pkgs;
hpkgs = pkgs.haskell.packages.${compiler};
in
(import ./. { inherit nixpkgs compiler; }).overrideAttrs (oldAttrs: {
nativeBuildInputs = [ hpkgs.cabal-install hpkgs.cabal2nix ];
})
@ddellacosta
Copy link
Author

clever in #nixos gave me this approach which is pretty neat:

{ nixpkgs ? import ./pinned.nix {}, compiler ? "ghc863" }:

let
  inherit (nixpkgs) pkgs;
  hpkgs = pkgs.haskell.packages.${compiler};
in
(hpkgs.callCabal2nix "servant-pt1" ./. {}).env.overrideAttrs(drv: {
  buildInputs = drv.buildInputs ++ [ hpkgs.cabal-install ];
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment