Skip to content

Instantly share code, notes, and snippets.

@codygman
Created May 5, 2018 20:30
Show Gist options
  • Save codygman/0fcc522ee1ef37158253239a0b6980f3 to your computer and use it in GitHub Desktop.
Save codygman/0fcc522ee1ef37158253239a0b6980f3 to your computer and use it in GitHub Desktop.
{ mkDerivation, base, lens, stdenv, webdriver }:
mkDerivation {
pname = "myproject";
version = "0.1.0.0";
src = ./.;
isLibrary = false;
isExecutable = true;
executableHaskellDepends = [ base lens webdriver ];
license = stdenv.lib.licenses.unfree;
hydraPlatforms = stdenv.lib.platforms.none;
}
-- Initial myproject.cabal generated by cabal init. For
-- further documentation, see http://haskell.org/cabal/users-guide/
name: myproject
version: 0.1.0.0
-- synopsis:
-- description:
license: AllRightsReserved
license-file: LICENSE
author: name
maintainer: email
-- copyright:
category: Web
build-type: Simple
extra-source-files: ChangeLog.md
cabal-version: >=1.10
executable myproject
main-is: Main.hs
-- other-modules:
-- other-extensions:
build-depends: base
, lens
, webdriver
hs-source-dirs: src
default-language: Haskell2010
{ nixpkgs ? import <nixpkgs> {}, compiler ? "default", doBenchmark ? false }:
let
inherit (nixpkgs) pkgs;
webdriver = pkgs.haskellPackages.callHackage "webdriver" "0.8.5" {};
f = { mkDerivation, base, lens, stdenv, webdriver }:
mkDerivation {
pname = "myproject";
version = "0.1.0.0";
src = ./.;
isLibrary = false;
isExecutable = true;
# buildInputs = [ pkgs.chromeDriver ]; # this is invalid
executableHaskellDepends = [ base lens webdriver ];
license = stdenv.lib.licenses.unfree;
hydraPlatforms = stdenv.lib.platforms.none;
};
haskellPackages = if compiler == "default"
then pkgs.haskellPackages
else pkgs.haskell.packages.${compiler};
variant = if doBenchmark then pkgs.haskell.lib.doBenchmark else pkgs.lib.id;
drv = variant (haskellPackages.callPackage f {});
in
if pkgs.lib.inNixShell then drv.env else drv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment