blob: 8ea5cb024793f4f0225173ec7297c84f5508f5ba (
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
|
self: {
lib,
flake-parts-lib,
...
}: let
inherit
(flake-parts-lib)
mkPerSystemOption
;
inherit
(lib)
literalExpression
literalMd
mdDoc
mkOption
types
;
procfileSubmodule = {
config,
name,
system,
pkgs,
...
}: {
options = {
processes = mkOption {
type = types.attrsOf types.str;
default = {};
description = mdDoc "Attribute set mapping the names of processes to their command";
example = literalExpression ''
{
redis = lib.getExe' pkgs.redis "redis-server";
}
'';
};
procRunner = mkOption {
type = types.package;
default = pkgs.overmind;
defaultText = literalMd "pkgs.overmind";
description = mdDoc ''
The Procfile runner to use. Officially supports: overmind, honcho.
If using an unsupported procRunner, the Procfile path will be passed as an argument to the procRunner.
'';
example = literalExpression "pkgs.honcho";
};
package = mkOption {
type = types.package;
description = mdDoc "Final package containing runner for Procfile";
readOnly = true;
};
};
config = {
package = self.lib.${system}.mkProcfileRunner {
inherit name;
procGroup = config.processes;
inherit (config) procRunner;
};
};
};
in {
options = {
perSystem = mkPerSystemOption ({
system,
pkgs,
...
}: {
options = {
procfiles = mkOption {
type = types.attrsOf (types.submoduleWith {
modules = [procfileSubmodule];
specialArgs = {inherit system pkgs;};
});
default = {};
description = mdDoc "Attribute set containing procfile declarations";
example = literalExpression ''
{
daemons.processes = {
redis = lib.getExe' pkgs.redis "redis-server";
};
}
'';
};
};
});
};
}
|