Repository navigation
Expand file tree
/
Copy pathflake.nix
More file actions
202 lines (191 loc) · 7.51 KB
/
Copy pathflake.nix
File metadata and controls
202 lines (191 loc) · 7.51 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
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
{
description = "mc-rtc Nix flake: public/private overlays for mc-rtc ecosystem that extends gepetto's";
inputs = {
gepetto.url = "github:gepetto/nix";
gepetto.inputs.systems.url = "github:nix-systems/default";
flakoboros.follows = "gepetto/flakoboros";
flake-parts.follows = "gepetto/flake-parts";
nixpkgs.follows = "gepetto/nixpkgs";
systems.follows = "gepetto/systems";
jrl-cmakemodulesv2 = {
url = "github:jrl-umi3218/jrl-cmakemodules";
inputs.gepetto.follows = "gepetto";
};
make-shell.url = "github:nicknovitski/make-shell";
# A tiny community repository that just yields a true/false value
# This is used by CI to activate the private overlay while remaining in pure evaluation mode
# Use as nix build . --override-input private-trigger github:boolean-option/true
private-trigger.url = "github:boolean-option/false";
ccache-trigger.url = "github:boolean-option/false";
with-ros-trigger.url = "github:boolean-option/true";
with-python-trigger.url = "github:boolean-option/true";
};
outputs =
{ self, ... }@inputs:
let
flakeModule = inputs.flake-parts.lib.importApply ./module.nix {
inherit (inputs)
gepetto
flakoboros
jrl-cmakemodulesv2
make-shell
;
mc-rtc-lib = self.lib;
};
inputTriggers = {
buildPrivate = inputs.private-trigger.value or false;
with-ros = inputs.with-ros-trigger.value or true;
with-python = inputs.with-python-trigger.value or true;
ccache = inputs.ccache-trigger.value or false;
};
mkFlakoboros =
{
localInputs,
localFlakeModule ? flakeModule,
}:
mcRtcFlakeModule:
inputs.flake-parts.lib.mkFlake { inputs = localInputs; } (args: {
systems = import inputs.systems;
imports = [
localFlakeModule
{ flakoboros = mcRtcFlakeModule args; }
];
});
mkMcRtcModule =
{
localInputs,
defaultAttrs ? { },
localFlakeModule ? flakeModule, # mc-rtc-nix flakeModule
}:
mcRtcFlakeModule:
inputs.flake-parts.lib.mkFlake { inputs = localInputs; } (args: {
systems = import inputs.systems;
imports = [
localFlakeModule # inputs.mc-rtc-nix.flakeModule
((mcRtcFlakeModule args) // defaultAttrs)
];
});
mkMcRtcController =
{
localInputs,
controllerName,
mkControllerSuperbuild,
localFlakeModule ? flakeModule, # mc-rtc-nix flakeModule
}:
mkMcRtcModule {
inherit localInputs localFlakeModule;
defaultAttrs = {
mc-rtc-superbuild =
{ pkgs, ... }:
{
enable = true;
configurations = {
"${controllerName}" = (mkControllerSuperbuild pkgs (builtins.getAttr controllerName pkgs) { });
};
};
};
};
in
inputs.flake-parts.lib.mkFlake { inherit inputs; } (
{ lib, ... }:
{
systems = import inputs.systems;
imports = [
flakeModule
{
mc-rtc-nix = {
packages = true;
with-ros = inputTriggers.with-ros;
with-python = inputTriggers.with-python;
# gepetto.packages = true;
# gepetto.devShells = true;
overlays = {
private = inputTriggers.buildPrivate;
ccache = inputTriggers.ccache;
};
};
mc-rtc-superbuild = {
enable = true;
shells.defaultShells.release = true;
};
}
];
flake = {
inherit flakeModule;
lib =
let
mc-rtc-lib = import ./lib { inherit lib; };
in
mc-rtc-lib
// {
# lib.mkFlakoboros
# Usage: lib.mkFlakoboros localInputs module
# Description: Creates a flake using the default flakeModule
# Arguments:
# - localInputs: The flake inputs set.
# - flakoborosModule: The flake-parts module to use.
# See https://gepetto.github.io/flakoboros/index.html
mkFlakoboros =
localInputs: flakoborosModule:
builtins.trace "mkFlakoboros is deprecated, please use mkMcRtcModule instead" mkFlakoboros {
inherit localInputs;
} flakoborosModule;
# lib.mkMcRtcModule
# Usage: lib.mkFlakoboros localInputs module
# Description: Creates a flake using the default flakeModule (public, with-ros).
# Arguments:
# - localInputs: The flake inputs set.
# - flakoborosModule: The flake-parts module to use.
# See https://gepetto.github.io/flakoboros/index.html
mkMcRtcModule = localInputs: mcRtcModule: mkMcRtcModule { inherit localInputs; } mcRtcModule;
# lib.mkMcRtcController
# Same as mkMcRtcModule but adds a default configuration for the controller (defined in ${controller}.passthru.mc-rtc)
# Usage: lib.mkMcRtcController localInputs "controller-name" module
# Description: Creates a flake using the default flakeModule and configures mc-rtc-superbuild with
# a default configuration for the controller (defined in ${controller}.passthru.mc-rtc)
# Arguments:
# - localInputs: The flake inputs set.
# - controllerName: Name of the controller
# - flakoborosModule: The flake-parts module to use.
# See https://gepetto.github.io/flakoboros/index.html
mkMcRtcController =
localInputs: controllerName: flakoborosModule:
mkMcRtcController {
inherit localInputs controllerName;
mkControllerSuperbuild = mc-rtc-lib.mkControllerSuperbuild;
} flakoborosModule;
};
templates = {
default = {
path = ./templates/default;
description = "A template for use with mc-rtc/nixpkgs";
};
controller = {
path = ./templates/controller;
description = "Simplified template with an auto-generated mc-rtc-superbuild configuration to build a controller";
};
superbuild = {
path = ./templates/superbuild;
description = "A template with a manual mc-rtc-superbuild configuration";
};
flakoboros = {
path = ./templates/flakoboros;
description = "A flakoboros template for simple projects";
};
flakoboros-new-package = {
path = ./templates/flakoboros-new-package;
description = "A flakoboros template for simple projects";
};
flakoboros-new-cpp-package = {
path = ./templates/flakoboros-new-cpp-package;
description = "A flakoboros template for C++ projects (cmake + catch2 + jrl-cmakemodules)";
};
ros = {
path = ./templates/ros;
description = "A template for use with mc-rtc/nixpkgs and ROS";
};
};
};
}
);
}