blob: 8c3627dcbb9af96b933e5b989351f408b254ad61 (
plain)
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
|
{
config,
lib,
inputs,
self,
...
}:
let
namespace = "colmena";
nodes = lib.filterAttrs (
name: _:
!(lib.elem name [
"meta"
"defaults"
])
) config.${namespace};
hasNodes = lib.length (lib.attrNames nodes) > 0;
metaSubmodule = {
options = {
allowApplyAll = lib.mkOption {
type = lib.types.bool;
default = true;
description = "Whether to allow deployments without a node filter set.";
};
description = lib.mkOption {
type = lib.types.str;
description = "A short description for the configuration.";
example = lib.literalExpression "A Colmena Hive";
};
machinesFile = lib.mkOption {
type = lib.types.nullOr lib.types.path;
default = null;
description = "Use the machines listed in this file when building this hive configuration.";
};
name = lib.mkOption {
type = lib.types.str;
default = "hive";
description = "The name of the configuration.";
};
nixpkgs = lib.mkOption {
type = lib.types.lazyAttrsOf lib.types.raw;
default = inputs.nixpkgs.legacyPackages.x86_64-linux;
defaultText = lib.literalExpression "inputs.nixpkgs.legacyPackages.x86_64-linux";
description = "The pinned Nixpkgs package set.";
example = lib.literalExpression ''
import inputs.nixpkgs { system = "x86_64-linux"; }
'';
};
nodeNixpkgs = lib.mkOption {
type = lib.types.attrsOf (lib.types.lazyAttrsOf lib.types.raw);
default = { };
description = "Node-specific Nixpkgs pins.";
};
nodeSpecialArgs = lib.mkOption {
type = lib.types.lazyAttrsOf lib.types.raw;
default = { };
description = "Node-specific special args.";
};
specialArgs = lib.mkOption {
type = lib.types.lazyAttrsOf lib.types.raw;
default = { };
description = "A set of special arguments to be passed to NixOS modules.";
};
};
};
colmenaSubmodule = {
freeformType = lib.types.lazyAttrsOf lib.types.deferredModule;
options = {
meta = lib.mkOption {
type = lib.types.submodule metaSubmodule;
default = { };
description = ''
Options for the `meta` attribute set.
See <link xlink:href="https://colmena.cli.rs/unstable/reference/meta.html"/>
'';
};
defaults = lib.mkOption {
type = lib.types.deferredModule;
default = { };
description = "Module imported by all nodes.";
};
};
};
in
{
options.${namespace} = lib.mkOption {
type = lib.types.submodule colmenaSubmodule;
default = { };
description = ''
Options for `colmena`.
See <link xlink:href="https://colmena.cli.rs/unstable/"/>
'';
};
config = lib.mkIf hasNodes {
flake = {
inherit (config) colmena;
colmenaHive = inputs.colmena.lib.makeHive self.colmena;
};
};
}
|