added enableConfigFile option to mize daemon nix module
This commit is contained in:
@@ -242,7 +242,6 @@ in {
|
|||||||
};
|
};
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
mize_project_root=$(${pkgs.lib.getExe pkgs.git} rev-parse --show-toplevel)
|
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";
|
#_shell_type = "rust";
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
@@ -332,6 +331,11 @@ in {
|
|||||||
example = "/home/user/here/mize.toml";
|
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";
|
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 {
|
config = lib.mkOption {
|
||||||
type = lib.types.attrsOf lib.types.anything;
|
type = lib.types.attrsOf lib.types.anything;
|
||||||
default = {};
|
default = {};
|
||||||
@@ -347,7 +351,7 @@ in {
|
|||||||
systemd.user.services.mize = {
|
systemd.user.services.mize = {
|
||||||
description = "the mize daemon";
|
description = "the mize daemon";
|
||||||
wantedBy = [ "default.target" ];
|
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}";
|
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 = {
|
serviceConfig = {
|
||||||
|
|||||||
Reference in New Issue
Block a user