termonad-2.1.0.0: .nix-helpers/nixpkgs.nix
# This file pins the version of nixpkgs to a known good version. The nixpkgs is
# imported with an overlay adding Termonad. It is imported from various other
# files.
{ # String representing a GHC version to use. Normally something like
# "ghc865". If null, then use a known-working GHC version.
compiler ? null
, # A path to nixpkgs. This will be imported. If null, use a known-working
# nixpkgs version.
nixpkgs ? null
, # Additional overlays to apply when importing nixpkgs.
additionalOverlays ? []
, # Build all the examples bundled with termonad. Normally this is only used
# in CI for testing that the examples all still compile.
buildExamples ? false
}:
let
nixpkgsSrc =
if isNull nixpkgs
then
builtins.fetchTarball {
# Recent version of nixpkgs-19.09 as of 2019-09-16.
url = "https://github.com/NixOS/nixpkgs/archive/64e38f246aebc1fcd800952322c08f92d1420660.tar.gz";
sha256 = "sha256:16cjhck691f8dhb996rx0xvcwsqxrxs4lfajgqjnv0zfr8f76srm";
}
else nixpkgs;
compilerVersion = if isNull compiler then "ghc865" else compiler;
# An overlay that adds termonad to all haskell package sets.
haskellPackagesOverlay = self: super: {
haskell = super.haskell // {
packageOverrides = hself: hsuper:
super.haskell.packageOverrides hself hsuper // {
termonad =
let
filesToIgnore = [
".git"
".nix-helpers"
"result"
".stack-work"
".travis.yml"
];
src =
builtins.filterSource
(path: type: with self.stdenv.lib;
! elem (baseNameOf path) filesToIgnore &&
! any (flip hasPrefix (baseNameOf path)) [ "dist" ".ghc" ]
)
./..;
extraCabal2nixOptions =
self.lib.optionalString buildExamples "-fbuildexamples";
termonadDrv =
hself.callCabal2nixWithOptions
"termonad"
src
extraCabal2nixOptions
{
inherit (self.gnome3) gtk3;
libpcre2 = self.pcre2;
vte_291 = self.gnome3.vte;
};
in
termonadDrv;
};
};
# A Haskell package set where we know the GHC version works to compile
# Termonad. This is basically just a shortcut so that other Nix files
# don't need to figure out the correct compiler version to use when it is
# not given by the user.
termonadKnownWorkingHaskellPkgSet = self.haskell.packages.${compilerVersion};
};
in import nixpkgsSrc { overlays = [ haskellPackagesOverlay ] ++ additionalOverlays; }