nixos/cassandra: Refactor: extract version variables
This commit is contained in:
parent
2be8b0ec2f
commit
90b1c9fa10
|
@ -19,6 +19,9 @@ let
|
|||
|
||||
cfg = config.services.cassandra;
|
||||
|
||||
atLeast3 = versionAtLeast cfg.package.version "3";
|
||||
atLeast3_11 = versionAtLeast cfg.package.version "3.11";
|
||||
|
||||
defaultUser = "cassandra";
|
||||
|
||||
cassandraConfig = flip recursiveUpdate cfg.extraConfig (
|
||||
|
@ -39,7 +42,7 @@ let
|
|||
parameters = [{ seeds = concatStringsSep "," cfg.seedAddresses; }];
|
||||
}
|
||||
];
|
||||
} // optionalAttrs (versionAtLeast cfg.package.version "3") {
|
||||
} // optionalAttrs atLeast3 {
|
||||
hints_directory = "${cfg.homeDir}/hints";
|
||||
}
|
||||
);
|
||||
|
@ -435,7 +438,7 @@ in
|
|||
jmxRolesFile = mkOption {
|
||||
type = types.nullOr types.path;
|
||||
default =
|
||||
if versionAtLeast cfg.package.version "3.11"
|
||||
if atLeast3_11
|
||||
then pkgs.writeText "jmx-roles-file" defaultJmxRolesFile
|
||||
else null;
|
||||
defaultText = literalMD ''generated configuration file if version is at least 3.11, otherwise `null`'';
|
||||
|
|
Loading…
Reference in a new issue