added enableConfigFile option to mize daemon nix module

This commit is contained in:
Sebastian Moser
2026-06-08 14:30:13 +02:00
parent 19573502d2
commit c57849f748

View File

@@ -242,7 +242,6 @@ in {
};
shellHook = ''
mize_project_root=$(${pkgs.lib.getExe pkgs.git} rev-parse --show-toplevel)
export MIZE_CONFIG_FILES=$mize_project_root/mize_config.toml
'';
#_shell_type = "rust";
nativeBuildInputs = [
@@ -332,6 +331,11 @@ in {
example = "/home/user/here/mize.toml";
description = "If set to NOT null, the mize daemon service will use the config file at this path instead of one written to the nix store";
};
enableConfigFile = lib.mkOption {
type = lib.types.bool;
default = true;
description = "allows to disable setting MIZE_CONFIG_FILES env var for the mize daemon service";
};
config = lib.mkOption {
type = lib.types.attrsOf lib.types.anything;
default = {};
@@ -347,7 +351,7 @@ in {
systemd.user.services.mize = {
description = "the mize daemon";
wantedBy = [ "default.target" ];
environment = {
environment = lib.mkIf config.mize.enableConfigFile {
MIZE_CONFIG_FILES = let fileInStore = (pkgs.formats.toml {}).generate "mize-daemon-config.toml" config.mize.config; in if config.mize.debugConfigFile == null then "${fileInStore}" else "${config.mize.debugConfigFile}";
};
serviceConfig = {