extras = path.is_dir()
if path.is_dir():
- path = path / "mkosi.conf"
+ path /= "mkosi.conf"
if not self.match_config(path):
return False
if extras:
- if local and (path.parent / "mkosi.local.conf").exists():
- self.parse_config_one(path.parent / "mkosi.local.conf")
-
- # Configuration from mkosi.local.conf should override other file based configuration but not
- # the CLI itself so move the finalized values to the CLI namespace.
- for s in SETTINGS:
- if hasattr(self.config, s.dest):
- setattr(self.cli, s.dest, self.finalize_value(s))
- delattr(self.config, s.dest)
+ if local:
+ if (
+ (localpath := path.parent / "mkosi.local/mkosi.conf").exists()
+ or (localpath := path.parent / "mkosi.local.conf").exists()
+ ): # fmt: skip
+ self.parse_config_one(localpath)
+
+ # Local configuration should override other file based
+ # configuration but not the CLI itself so move the finalized
+ # values to the CLI namespace.
+ for s in SETTINGS:
+ if hasattr(self.config, s.dest):
+ setattr(self.cli, s.dest, self.finalize_value(s))
+ delattr(self.config, s.dest)
for s in SETTINGS:
if (
Configuration is parsed in the following order:
* The command line arguments are parsed.
-* `mkosi.local.conf` is parsed if it exists. This file should be in
- `.gitignore` (or equivalent) and is intended for local configuration.
+* `mkosi.local.conf` or `mkosi.local` is parsed if it exists. This file or
+ directory should be in `.gitignore` (or equivalent) and is intended for local
+ configuration.
* Any default paths (depending on the option) are configured if the
corresponding path exists.
* `mkosi.conf` is parsed if it exists in the directory configured with
settings configured via configuration files. If the same setting is
configured more than once via configuration files, later assignments
override earlier assignments except for settings that take a collection
-of values. Also, settings read from `mkosi.local.conf` will override
-settings from configuration files that are parsed later, but not settings
-specified on the CLI.
+of values. Also, settings read from `mkosi.local` or `mkosi.local.conf` will
+override settings from configuration files that are parsed later, but not
+settings specified on the CLI.
For settings that take a single value, the empty assignment (`SomeSetting=` or
`--some-setting=`) can be used to override a previous setting and reset to the