lol

Merge pull request #237802 from SuperSandro2000/ceph-package-options

nixos/ceph: add options to configure package used by each component

authored by

Sandro and committed by
GitHub
eae22520 6788909b

+17 -14
+17 -14
nixos/modules/services/network-filesystems/ceph.nix
··· 3 3 with lib; 4 4 5 5 let 6 - cfg = config.services.ceph; 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 - makeServices = (daemonType: daemonIds: 12 + makeServices = daemonType: daemonIds: 13 13 mkMerge (map (daemonId: 14 - { "ceph-${daemonType}-${daemonId}" = makeService daemonType daemonId cfg.global.clusterName pkgs.ceph; }) 15 - daemonIds)); 14 + { "ceph-${daemonType}-${daemonId}" = makeService daemonType daemonId cfg.global.clusterName cfg.${daemonType}.package; }) 15 + daemonIds); 16 16 17 - makeService = (daemonType: daemonId: clusterName: ceph: 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 + }; 58 58 59 - makeTarget = (daemonType: 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 - } 69 - ); 68 + }; 70 69 in 71 70 { 72 71 options.services.ceph = { ··· 211 210 to the id part in ceph i.e. [ "name1" ] would result in mgr.name1 212 211 ''; 213 212 }; 213 + package = mkPackageOptionMD pkgs "ceph" { }; 214 214 extraConfig = mkOption { 215 215 type = with types; attrsOf str; 216 216 default = {}; ··· 231 231 to the id part in ceph i.e. [ "name1" ] would result in mon.name1 232 232 ''; 233 233 }; 234 + package = mkPackageOptionMD pkgs "ceph" { }; 234 235 extraConfig = mkOption { 235 236 type = with types; attrsOf str; 236 237 default = {}; ··· 251 252 to the id part in ceph i.e. [ "name1" ] would result in osd.name1 252 253 ''; 253 254 }; 254 - 255 + package = mkPackageOptionMD pkgs "ceph" { }; 255 256 extraConfig = mkOption { 256 257 type = with types; attrsOf str; 257 258 default = { ··· 279 280 to the id part in ceph i.e. [ "name1" ] would result in mds.name1 280 281 ''; 281 282 }; 283 + package = mkPackageOptionMD pkgs "ceph" { }; 282 284 extraConfig = mkOption { 283 285 type = with types; attrsOf str; 284 286 default = {}; ··· 290 292 291 293 rgw = { 292 294 enable = mkEnableOption (lib.mdDoc "Ceph RadosGW daemon"); 295 + package = mkPackageOptionMD pkgs "ceph" { }; 293 296 daemons = mkOption { 294 297 type = with types; listOf str; 295 298 default = []; ··· 328 331 { assertion = cfg.global.fsid != ""; 329 332 message = "fsid has to be set to a valid uuid for the cluster to function"; 330 333 } 331 - { assertion = cfg.mon.enable == true -> cfg.mon.daemons != []; 334 + { assertion = cfg.mon.enable -> cfg.mon.daemons != []; 332 335 message = "have to set id of atleast one MON if you're going to enable Monitor"; 333 336 } 334 - { assertion = cfg.mds.enable == true -> cfg.mds.daemons != []; 337 + { assertion = cfg.mds.enable -> cfg.mds.daemons != []; 335 338 message = "have to set id of atleast one MDS if you're going to enable Metadata Service"; 336 339 } 337 - { assertion = cfg.osd.enable == true -> cfg.osd.daemons != []; 340 + { assertion = cfg.osd.enable -> cfg.osd.daemons != []; 338 341 message = "have to set id of atleast one OSD if you're going to enable OSD"; 339 342 } 340 - { assertion = cfg.mgr.enable == true -> cfg.mgr.daemons != []; 343 + { assertion = cfg.mgr.enable -> cfg.mgr.daemons != []; 341 344 message = "have to set id of atleast one MGR if you're going to enable MGR"; 342 345 } 343 346 ];