tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
0
fork
atom
lol
0
fork
atom
overview
issues
pulls
pipelines
nixos/ceph: run statix fix
Sandro Jäckel
2 years ago
e1fedfdf
75a5ebf4
+11
-12
1 changed file
expand all
collapse all
unified
split
nixos
modules
services
network-filesystems
ceph.nix
+11
-12
nixos/modules/services/network-filesystems/ceph.nix
···
3
3
with lib;
4
4
5
5
let
6
6
-
cfg = config.services.ceph;
6
6
+
cfg = config.services.ceph;
7
7
8
8
# function that translates "camelCaseOptions" to "camel case options", credits to tilpner in #nixos@freenode
9
9
expandCamelCase = replaceStrings upperChars (map (s: " ${s}") lowerChars);
10
10
expandCamelCaseAttrs = mapAttrs' (name: value: nameValuePair (expandCamelCase name) value);
11
11
12
12
-
makeServices = (daemonType: daemonIds:
12
12
+
makeServices = daemonType: daemonIds:
13
13
mkMerge (map (daemonId:
14
14
{ "ceph-${daemonType}-${daemonId}" = makeService daemonType daemonId cfg.global.clusterName pkgs.ceph; })
15
15
-
daemonIds));
15
15
+
daemonIds);
16
16
17
17
-
makeService = (daemonType: daemonId: clusterName: ceph:
17
17
+
makeService = daemonType: daemonId: clusterName: ceph:
18
18
let
19
19
stateDirectory = "ceph/${if daemonType == "rgw" then "radosgw" else daemonType}/${clusterName}-${daemonId}"; in {
20
20
enable = true;
···
54
54
} // optionalAttrs ( daemonType == "mon") {
55
55
RestartSec = "10";
56
56
};
57
57
-
});
57
57
+
};
58
58
59
59
-
makeTarget = (daemonType:
59
59
+
makeTarget = daemonType:
60
60
{
61
61
"ceph-${daemonType}" = {
62
62
description = "Ceph target allowing to start/stop all ceph-${daemonType} services at once";
···
65
65
before = [ "ceph.target" ];
66
66
unitConfig.StopWhenUnneeded = true;
67
67
};
68
68
-
}
69
69
-
);
68
68
+
};
70
69
in
71
70
{
72
71
options.services.ceph = {
···
328
327
{ assertion = cfg.global.fsid != "";
329
328
message = "fsid has to be set to a valid uuid for the cluster to function";
330
329
}
331
331
-
{ assertion = cfg.mon.enable == true -> cfg.mon.daemons != [];
330
330
+
{ assertion = cfg.mon.enable -> cfg.mon.daemons != [];
332
331
message = "have to set id of atleast one MON if you're going to enable Monitor";
333
332
}
334
334
-
{ assertion = cfg.mds.enable == true -> cfg.mds.daemons != [];
333
333
+
{ assertion = cfg.mds.enable -> cfg.mds.daemons != [];
335
334
message = "have to set id of atleast one MDS if you're going to enable Metadata Service";
336
335
}
337
337
-
{ assertion = cfg.osd.enable == true -> cfg.osd.daemons != [];
336
336
+
{ assertion = cfg.osd.enable -> cfg.osd.daemons != [];
338
337
message = "have to set id of atleast one OSD if you're going to enable OSD";
339
338
}
340
340
-
{ assertion = cfg.mgr.enable == true -> cfg.mgr.daemons != [];
339
339
+
{ assertion = cfg.mgr.enable -> cfg.mgr.daemons != [];
341
340
message = "have to set id of atleast one MGR if you're going to enable MGR";
342
341
}
343
342
];