-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.nix
69 lines (66 loc) · 1.8 KB
/
main.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
{ config, lib, pkgs, self, ...}:
{
options = with lib; {
name = mkOption {
type = types.str;
description = "name of the project";
};
version = mkOption {
type = types.str;
description = "version of the package";
default = "0.0.0";
};
src = mkOption {
type = types.path;
description = "path to the source code";
example = "./.";
default = self;
};
src_exclude = mkOption {
type = with types; listOf (either str path);
description = "additional paths to ignore in addition to .gitignore (use for files that need to be in the repo, but aren't needed for building)";
example = ''["*" "!/my_project"]'';
default = [];
};
#cross_compile = mkOption {
# type = types.bool;
# description = "try to cross compile";
# default = false;
# example = "true";
#};
dev_commands = mkOption {
type = types.listOf types.package;
description = "list of packages to include in dev environment (exposes only /bin and /share)";
default = [];
};
dev_apps = mkOption {
type = types.listOf types.package;
description = "list of packages to include in dev environment";
default = [];
};
shell_hook = mkOption {
type = types.lines;
description = "additional commands to execute when entering the shell";
default = "";
};
out_shell = mkOption {
type = types.package;
readOnly = true;
};
};
config = let
dev_tools_env = pkgs.buildEnv {
name = config.name + "-dev-tools";
paths = config.dev_commands;
pathsToLink = [
"/bin"
"/share"
];
};
in {
out_shell = pkgs.mkShell {
buildInputs = config.dev_apps ++ [ dev_tools_env ];
shellHook = config.shell_hook;
};
};
}