-
Notifications
You must be signed in to change notification settings - Fork 1
/
default.nix
68 lines (66 loc) · 1.64 KB
/
default.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# Building gtfsschedule
#
# You should be able to simply invoke:
#
# $ nix-build
#
# or, to be explicit:
#
# $ nix-build default.nix
#
# in gtfsschedule's root directory in order to build gtfsschedule. You'll find the binary under:
#
# $ ls result/bin/gtfsschedule
#
# if the build was successful.
#
#
# Choosing a different compiler than the default
#
# In order to choose a different compiler, invoke nix build like so (escaping
# the quotes is needed, since we're passing a string literal):
#
# $ nix-build --arg compiler \"ghc442\"
#
# Use as a development environment
#
# $ nix-shell default.nix
#
{ compiler ? null, nixpkgs ? null, with-icu ? false }:
with (import .nix/nixpkgs.nix { inherit compiler nixpkgs; });
let
envPackages = self: [ self.gtfsschedule ];
env = haskellPackages.ghcWithPackages envPackages;
nativeBuildTools = with pkgs.haskellPackages; [
cabal-install
cabal2nix
ghcid
hlint
haskell-language-server
ormolu
hprotoc
hie-bios
pkgs.gnumake
pkgs.asciidoctor
pkgs.python3Packages.pygments
];
in
if pkgs.lib.inNixShell
then haskellPackages.shellFor {
withHoogle = true;
packages = haskellPackages: [ haskellPackages.gtfsschedule ];
nativeBuildInputs = haskellPackages.gtfsschedule.env.nativeBuildInputs ++ nativeBuildTools;
}
else {
gtfsschedule = pkgs.stdenv.mkDerivation {
name = "gtfsschedule-with-packages-${env.version}";
nativeBuildInputs = [ pkgs.makeWrapper ];
buildCommand = ''
mkdir -p $out/bin
makeWrapper ${env}/bin/gtfsschedule $out/bin/gtfsschedule \
--set NIX_GHC "${env}/bin/ghc"
'';
preferLocalBuild = true;
allowSubstitutes = false;
};
}