2 Simulate a migration from a single-instance `services.foo` to a multi instance
3 `services.foos.<name>` module, where `name = ""` serves as the legacy /
4 compatibility instance.
6 - No instances must exist, unless one is defined in the multi-instance module,
7 or if the legacy enable option is set to true.
8 - The legacy instance options must be renamed to the new instance, if it exists.
10 The relevant scenarios are tested in separate files:
11 - ./doRename-condition-enable.nix
12 - ./doRename-condition-no-enable.nix
16 inherit (lib) mkOption mkEnableOption types doRename;
20 services.foo.enable = mkEnableOption "foo";
21 services.foos = mkOption {
22 type = types.attrsOf (types.submodule {
24 bar = mkOption { type = types.str; };
33 from = [ "services" "foo" "bar" ];
34 to = [ "services" "foos" "" "bar" ];
39 condition = config.services.foo.enable;