Skip to content

Instantly share code, notes, and snippets.

@Steell
Last active September 28, 2018 19: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 Steell/94059c83fca59111581ed32f7df24a57 to your computer and use it in GitHub Desktop.
Save Steell/94059c83fca59111581ed32f7df24a57 to your computer and use it in GitHub Desktop.
Haskell + Nix testing
# shell.nix
let
releaseDrv = import ./release.nix;
cabal = releaseDrv.haskellPackages.cabal;
in
releaseDrv
.haskell-nix-sandbox
.env
.overrideAttrs (drv: {
buildTools =
(drv.buildInputs or []) ++ [ cabal ];
})
# release.nix
let config = { allowUnfree = true; };
overlays = [
(newPkgs: oldPkgs: {
haskellPackages = oldPkgs.haskellPackages.override { overrides =
haskellPackagesNew: haskellPackagesOld: {
# List packages here!
haskell-nix-sandbox =
haskellPackagesNew.callPackage ./default.nix {};
};
};
})
];
nixpkgs = <nixpkgs>; # import ./nix/17_09.nix
pkgs = import nixpkgs { inherit config overlays; };
in
{ inherit (pkgs) haskellPackages;
inherit (pkgs.haskellPackages) haskell-nix-sandbox;
}
# default.nix
{ callCabal2nix
? (import <nixpkgs> {}).haskellPackages.callCabal2nix
}:
callCabal2nix "haskell-nix-sandbox" ./. {}
# haskell-nix-sandbox.cabal
name: haskell-nix-sandbox
version: 0.0.1
synopsis: Sandbox for developing haskell on top of nix
homepage: https://github.com/Steell/haskell-nix-sandbox#readme
Bug-Reports: https://github.com/Steell/haskell-nix-sandbox/issues
license: Apache-2.0
license-file: LICENSE
author: Steve Elliott
maintainer: steve@steellworks.com
copyright: 2018 Steve Elliott
category: Misc
build-type: Simple
cabal-version: >=1.10
extra-source-files:
LICENSE
README.md
library
ghc-options: -Wall
hs-source-dirs: src
exposed-modules:
HaskellNix.Foo
build-depends:
base >= 4.9 && < 5,
async >= 2.2.0.0 && < 2.3
executable haskell-nix-sandbox
hs-source-dirs: exe
main-is: Main.hs
ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall
build-depends:
base >= 4.9 && < 5,
haskell-nix-sandbox,
lens >= 4.0
default-language: Haskell2010
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment