tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
0
fork
atom
lol
0
fork
atom
overview
issues
pulls
pipelines
nixos/services.gollum: remove `with lib;`
Felix Buehler
2 years ago
22d14ed8
9358cb9b
+42
-45
1 changed file
expand all
collapse all
unified
split
nixos
modules
services
misc
gollum.nix
+42
-45
nixos/modules/services/misc/gollum.nix
···
4
4
pkgs,
5
5
...
6
6
}:
7
7
-
8
8
-
with lib;
9
9
-
10
7
let
11
8
cfg = config.services.gollum;
12
9
in
13
10
14
11
{
15
12
imports = [
16
16
-
(mkRemovedOptionModule
13
13
+
(lib.mkRemovedOptionModule
17
14
[
18
15
"services"
19
16
"gollum"
···
24
21
];
25
22
26
23
options.services.gollum = {
27
27
-
enable = mkEnableOption "Gollum, a git-powered wiki service";
24
24
+
enable = lib.mkEnableOption "Gollum, a git-powered wiki service";
28
25
29
29
-
address = mkOption {
30
30
-
type = types.str;
26
26
+
address = lib.mkOption {
27
27
+
type = lib.types.str;
31
28
default = "0.0.0.0";
32
29
description = "IP address on which the web server will listen.";
33
30
};
34
31
35
35
-
port = mkOption {
36
36
-
type = types.port;
32
32
+
port = lib.mkOption {
33
33
+
type = lib.types.port;
37
34
default = 4567;
38
35
description = "Port on which the web server will run.";
39
36
};
40
37
41
41
-
extraConfig = mkOption {
42
42
-
type = types.lines;
38
38
+
extraConfig = lib.mkOption {
39
39
+
type = lib.types.lines;
43
40
default = "";
44
41
description = "Content of the configuration file";
45
42
};
46
43
47
47
-
math = mkOption {
48
48
-
type = types.bool;
44
44
+
math = lib.mkOption {
45
45
+
type = lib.types.bool;
49
46
default = false;
50
47
description = "Enable support for math rendering using KaTeX";
51
48
};
52
49
53
53
-
allowUploads = mkOption {
54
54
-
type = types.nullOr (
55
55
-
types.enum [
50
50
+
allowUploads = lib.mkOption {
51
51
+
type = lib.types.nullOr (
52
52
+
lib.types.enum [
56
53
"dir"
57
54
"page"
58
55
]
···
61
58
description = "Enable uploads of external files";
62
59
};
63
60
64
64
-
user-icons = mkOption {
65
65
-
type = types.nullOr (
66
66
-
types.enum [
61
61
+
user-icons = lib.mkOption {
62
62
+
type = lib.types.nullOr (
63
63
+
lib.types.enum [
67
64
"gravatar"
68
65
"identicon"
69
66
]
···
72
69
description = "Enable specific user icons for history view";
73
70
};
74
71
75
75
-
emoji = mkOption {
76
76
-
type = types.bool;
72
72
+
emoji = lib.mkOption {
73
73
+
type = lib.types.bool;
77
74
default = false;
78
75
description = "Parse and interpret emoji tags";
79
76
};
80
77
81
81
-
h1-title = mkOption {
82
82
-
type = types.bool;
78
78
+
h1-title = lib.mkOption {
79
79
+
type = lib.types.bool;
83
80
default = false;
84
81
description = "Use the first h1 as page title";
85
82
};
86
83
87
87
-
no-edit = mkOption {
88
88
-
type = types.bool;
84
84
+
no-edit = lib.mkOption {
85
85
+
type = lib.types.bool;
89
86
default = false;
90
87
description = "Disable editing pages";
91
88
};
92
89
93
93
-
local-time = mkOption {
94
94
-
type = types.bool;
90
90
+
local-time = lib.mkOption {
91
91
+
type = lib.types.bool;
95
92
default = false;
96
93
description = "Use the browser's local timezone instead of the server's for displaying dates.";
97
94
};
98
95
99
99
-
branch = mkOption {
100
100
-
type = types.str;
96
96
+
branch = lib.mkOption {
97
97
+
type = lib.types.str;
101
98
default = "master";
102
99
example = "develop";
103
100
description = "Git branch to serve";
104
101
};
105
102
106
106
-
stateDir = mkOption {
107
107
-
type = types.path;
103
103
+
stateDir = lib.mkOption {
104
104
+
type = lib.types.path;
108
105
default = "/var/lib/gollum";
109
106
description = "Specifies the path of the repository directory. If it does not exist, Gollum will create it on startup.";
110
107
};
111
108
112
112
-
package = mkPackageOption pkgs "gollum" { };
109
109
+
package = lib.mkPackageOption pkgs "gollum" { };
113
110
114
114
-
user = mkOption {
115
115
-
type = types.str;
111
111
+
user = lib.mkOption {
112
112
+
type = lib.types.str;
116
113
default = "gollum";
117
114
description = "Specifies the owner of the wiki directory";
118
115
};
119
116
120
120
-
group = mkOption {
121
121
-
type = types.str;
117
117
+
group = lib.mkOption {
118
118
+
type = lib.types.str;
122
119
default = "gollum";
123
120
description = "Specifies the owner group of the wiki directory";
124
121
};
125
122
};
126
123
127
127
-
config = mkIf cfg.enable {
124
124
+
config = lib.mkIf cfg.enable {
128
125
129
129
-
users.users.gollum = mkIf (cfg.user == "gollum") {
126
126
+
users.users.gollum = lib.mkIf (cfg.user == "gollum") {
130
127
group = cfg.group;
131
128
description = "Gollum user";
132
129
createHome = false;
···
158
155
--host ${cfg.address} \
159
156
--config ${pkgs.writeText "gollum-config.rb" cfg.extraConfig} \
160
157
--ref ${cfg.branch} \
161
161
-
${optionalString cfg.math "--math"} \
162
162
-
${optionalString cfg.emoji "--emoji"} \
163
163
-
${optionalString cfg.h1-title "--h1-title"} \
164
164
-
${optionalString cfg.no-edit "--no-edit"} \
165
165
-
${optionalString cfg.local-time "--local-time"} \
166
166
-
${optionalString (cfg.allowUploads != null) "--allow-uploads ${cfg.allowUploads}"} \
167
167
-
${optionalString (cfg.user-icons != null) "--user-icons ${cfg.user-icons}"} \
158
158
+
${lib.optionalString cfg.math "--math"} \
159
159
+
${lib.optionalString cfg.emoji "--emoji"} \
160
160
+
${lib.optionalString cfg.h1-title "--h1-title"} \
161
161
+
${lib.optionalString cfg.no-edit "--no-edit"} \
162
162
+
${lib.optionalString cfg.local-time "--local-time"} \
163
163
+
${lib.optionalString (cfg.allowUploads != null) "--allow-uploads ${cfg.allowUploads}"} \
164
164
+
${lib.optionalString (cfg.user-icons != null) "--user-icons ${cfg.user-icons}"} \
168
165
${cfg.stateDir}
169
166
'';
170
167
};