-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpackage.nix
More file actions
42 lines (36 loc) · 1.26 KB
/
package.nix
File metadata and controls
42 lines (36 loc) · 1.26 KB
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
# file: package.nix
# The items in the curly brackets are function parameters as this is a Nix
# function that accepts dependency inputs and returns a new package
# description
{ lib
, stdenv
, cmake
, doctest
, bashInteractive
, enableTests ? true
}:
# stdenv.mkDerivation now accepts a list of named parameters that describe
# the package itself.
stdenv.mkDerivation {
name = "archetype";
# good source filtering is important for caching of builds.
# It's easier when subprojects have their own distinct subfolders.
src = lib.sourceByRegex ./. [
"^include.*"
"^src.*"
"^test.*"
"CMakeLists.txt"
];
# We now list the dependencies similar to the devShell before.
# Distinguishing between `nativeBuildInputs` (runnable on the host
# at compile time) and normal `buildInputs` (runnable on target
# platform at run time) is an important preparation for cross-compilation.
nativeBuildInputs = [ cmake bashInteractive ];
buildInputs = [ ];
checkInputs = [ doctest ];
# Instruct the build process to run tests.
# The generic builder script of `mkDerivation` handles all the default
# command lines of several build systems, so it knows how to run our tests.
doCheck = enableTests;
cmakeFlags = lib.optional (!enableTests) "-DTESTING=off";
}