diff options
author | Kai Wohlfahrt <kai.wohlfahrt@gmail.com> | 2022-06-04 14:43:44 +0100 |
---|---|---|
committer | Jörg Thalheim <joerg@thalheim.io> | 2022-06-29 19:59:06 +0200 |
commit | 6e6f33ad838a4935fb51684a56f6f27bcc56c4e6 (patch) | |
tree | bfe1248200e324696fb2d13d7ea0537289799dfc | |
parent | df0bbd399cdb89ff1e5768943b23516e5228d717 (diff) | |
download | nixpkgs-6e6f33ad838a4935fb51684a56f6f27bcc56c4e6.tar nixpkgs-6e6f33ad838a4935fb51684a56f6f27bcc56c4e6.tar.gz nixpkgs-6e6f33ad838a4935fb51684a56f6f27bcc56c4e6.tar.bz2 nixpkgs-6e6f33ad838a4935fb51684a56f6f27bcc56c4e6.tar.lz nixpkgs-6e6f33ad838a4935fb51684a56f6f27bcc56c4e6.tar.xz nixpkgs-6e6f33ad838a4935fb51684a56f6f27bcc56c4e6.tar.zst nixpkgs-6e6f33ad838a4935fb51684a56f6f27bcc56c4e6.zip |
openldap: remove deprecated options
-rw-r--r-- | nixos/modules/services/databases/openldap.nix | 43 | ||||
-rw-r--r-- | nixos/tests/openldap.nix | 19 |
2 files changed, 0 insertions, 62 deletions
diff --git a/nixos/modules/services/databases/openldap.nix b/nixos/modules/services/databases/openldap.nix index d80d1b07b97..bba6007beb2 100644 --- a/nixos/modules/services/databases/openldap.nix +++ b/nixos/modules/services/databases/openldap.nix @@ -3,7 +3,6 @@ with lib; let cfg = config.services.openldap; - legacyOptions = [ "rootpwFile" "suffix" "dataDir" "rootdn" "rootpw" ]; openldap = cfg.package; configDir = if cfg.configDir != null then cfg.configDir else "/etc/openldap/slapd.d"; @@ -76,44 +75,6 @@ let lib.flatten (lib.mapAttrsToList (name: value: attrsToLdif "${name},${dn}" value) children) ); in { - imports = let - deprecationNote = "This option is removed due to the deprecation of `slapd.conf` upstream. Please migrate to `services.openldap.settings`, see the release notes for advice with this process."; - mkDatabaseOption = old: new: - lib.mkChangedOptionModule [ "services" "openldap" old ] [ "services" "openldap" "settings" "children" ] - (config: let - database = lib.getAttrFromPath [ "services" "openldap" "database" ] config; - value = lib.getAttrFromPath [ "services" "openldap" old ] config; - in lib.setAttrByPath ([ "olcDatabase={1}${database}" "attrs" ] ++ new) value); - in [ - (lib.mkRemovedOptionModule [ "services" "openldap" "extraConfig" ] deprecationNote) - (lib.mkRemovedOptionModule [ "services" "openldap" "extraDatabaseConfig" ] deprecationNote) - - (lib.mkChangedOptionModule [ "services" "openldap" "logLevel" ] [ "services" "openldap" "settings" "attrs" "olcLogLevel" ] - (config: lib.splitString " " (lib.getAttrFromPath [ "services" "openldap" "logLevel" ] config))) - (lib.mkChangedOptionModule [ "services" "openldap" "defaultSchemas" ] [ "services" "openldap" "settings" "children" "cn=schema" "includes"] - (config: lib.optionals (lib.getAttrFromPath [ "services" "openldap" "defaultSchemas" ] config) ( - map (schema: "${openldap}/etc/schema/${schema}.ldif") [ "core" "cosine" "inetorgperson" "nis" ]))) - - (lib.mkChangedOptionModule [ "services" "openldap" "database" ] [ "services" "openldap" "settings" "children" ] - (config: let - database = lib.getAttrFromPath [ "services" "openldap" "database" ] config; - in { - "olcDatabase={1}${database}".attrs = { - # objectClass is case-insensitive, so don't need to capitalize ${database} - objectClass = [ "olcdatabaseconfig" "olc${database}config" ]; - olcDatabase = "{1}${database}"; - olcDbDirectory = lib.mkDefault "/var/db/openldap"; - }; - "cn=schema".includes = lib.mkDefault ( - map (schema: "${openldap}/etc/schema/${schema}.ldif") [ "core" "cosine" "inetorgperson" "nis" ] - ); - })) - (mkDatabaseOption "rootpwFile" [ "olcRootPW" "path" ]) - (mkDatabaseOption "suffix" [ "olcSuffix" ]) - (mkDatabaseOption "dataDir" [ "olcDbDirectory" ]) - (mkDatabaseOption "rootdn" [ "olcRootDN" ]) - (mkDatabaseOption "rootpw" [ "olcRootPW" ]) - ]; options = { services.openldap = { enable = mkOption { @@ -248,10 +209,6 @@ in { meta.maintainers = with lib.maintainers; [ mic92 kwohlfahrt ]; config = mkIf cfg.enable { - assertions = map (opt: { - assertion = ((getAttr opt cfg) != "_mkMergedOptionModule") -> (cfg.database != "_mkMergedOptionModule"); - message = "Legacy OpenLDAP option `services.openldap.${opt}` requires `services.openldap.database` (use value \"mdb\" if unsure)"; - }) legacyOptions; environment.systemPackages = [ openldap ]; # Literal attributes must always be set diff --git a/nixos/tests/openldap.nix b/nixos/tests/openldap.nix index 3c388119d5d..1ef74fe30a2 100644 --- a/nixos/tests/openldap.nix +++ b/nixos/tests/openldap.nix @@ -60,25 +60,6 @@ in { }; }) { inherit pkgs system; }; - # Old-style configuration - oldOptions = import ./make-test-python.nix ({ pkgs, ... }: { - inherit testScript; - name = "openldap"; - - nodes.machine = { pkgs, ... }: { - services.openldap = { - enable = true; - logLevel = "stats acl"; - defaultSchemas = true; - database = "mdb"; - suffix = "dc=example"; - rootdn = "cn=root,dc=example"; - rootpw = "notapassword"; - declarativeContents."dc=example" = dbContents; - }; - }; - }) { inherit system pkgs; }; - # Manually managed configDir, for example if dynamic config is essential manualConfigDir = import ./make-test-python.nix ({ pkgs, ... }: { name = "openldap"; |