-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathdefault.nix
69 lines (56 loc) · 2.23 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
69
############################################################################
# hasktorch-skeleton Nix build
############################################################################
{ system ? builtins.currentSystem
, crossSystem ? null
# allows to customize ghc and profiling (see ./nix/haskell.nix):
, config ? {}
# allows to override dependencies of the hasktorch-skeleton project without modifications
, sourcesOverride ? {}
# If true, activates CUDA support
, cudaSupport ? false
# If cudaSupport is true, this needs to be set to a valid CUDA major version number, e.g. 10:
# nix-build --arg cudaSupport true --argstr cudaMajorVersion 10
, cudaMajorVersion ? null
# pinned version of nixpkgs augmented with various overlays including hasktorch
, pkgs ? import ./nix/default.nix {
inherit system crossSystem config sourcesOverride cudaSupport cudaMajorVersion;
}
}:
# commonLib include iohk-nix utilities, our util.nix and nixpkgs lib.
with pkgs; with commonLib;
let
haskellPackages = recRecurseIntoAttrs
# the Haskell.nix package set, reduced to local packages.
(selectProjectPackages hasktorchSkeletonHaskellPackages);
libs = collectComponents' "library" haskellPackages;
exes = collectComponents' "exes" haskellPackages;
self = {
inherit haskellPackages;
inherit (haskellPackages.hasktorch-skeleton.identifier) version;
# Grab library components of this package.
inherit (libs)
hasktorch-skeleton
;
# Grab executable components of this package.
inherit (exes);
# `tests` are the test suites which have been built.
tests = collectComponents' "tests" haskellPackages;
# `benchmarks` (only built, not run).
benchmarks = collectComponents' "benchmarks" haskellPackages;
checks = recurseIntoAttrs {
# `checks.tests` collect results of executing the tests:
tests = collectChecks haskellPackages;
};
shell = import ./shell.nix {
inherit pkgs;
withHoogle = true;
};
# Building the stack shell doesn't work in the sandbox. Pass `--option sandbox relaxed` or
# `--option sandbox false` to be able to build this. You have to be root in order to that.
# stackShell = import ./nix/stack-shell.nix {
# inherit pkgs;
# };
};
in
self