ops/nixos/seaweedfs: add earlyOptions for specifying flags like -v that need to be set before the subcommand

This commit is contained in:
Luke Granger-Brown 2024-10-20 17:22:26 +01:00
parent b0eb1f77a0
commit 32eccdd653

View file

@ -43,6 +43,12 @@ in {
type = lib.types.package; type = lib.types.package;
}; };
earlyOptions = lib.mkOption {
type = lib.types.submodule {
freeformType = commandLineType;
};
default = {};
};
options = lib.mkOption { options = lib.mkOption {
type = lib.types.submodule { type = lib.types.submodule {
freeformType = commandLineType; freeformType = commandLineType;
@ -76,6 +82,12 @@ in {
type = lib.types.package; type = lib.types.package;
}; };
earlyOptions = lib.mkOption {
type = lib.types.submodule {
freeformType = commandLineType;
};
default = {};
};
options = lib.mkOption { options = lib.mkOption {
type = lib.types.submodule { type = lib.types.submodule {
freeformType = commandLineType; freeformType = commandLineType;
@ -98,6 +110,12 @@ in {
type = lib.types.package; type = lib.types.package;
}; };
earlyOptions = lib.mkOption {
type = lib.types.submodule {
freeformType = commandLineType;
};
default = {};
};
options = lib.mkOption { options = lib.mkOption {
type = lib.types.submodule { type = lib.types.submodule {
freeformType = commandLineType; freeformType = commandLineType;
@ -160,7 +178,7 @@ in {
(config.environment.etc."seaweedfs/replication.toml".source) (config.environment.etc."seaweedfs/replication.toml".source)
]; ];
serviceConfig = { serviceConfig = {
ExecStart = "${cfg.filer.package}/bin/weed filer ${makeCommandLine cfg.filer.options}"; ExecStart = "${cfg.filer.package}/bin/weed ${makeCommandLine cfg.filer.earlyOptions} filer ${makeCommandLine cfg.filer.options}";
User = "seaweedfs-filer"; User = "seaweedfs-filer";
Group = "seaweedfs"; Group = "seaweedfs";
DynamicUser = true; DynamicUser = true;
@ -177,7 +195,7 @@ in {
(config.environment.etc."seaweedfs/security.toml".source) (config.environment.etc."seaweedfs/security.toml".source)
]; ];
serviceConfig = { serviceConfig = {
ExecStart = "${cfg.master.package}/bin/weed master ${makeCommandLine cfg.master.options}"; ExecStart = "${cfg.master.package}/bin/weed ${makeCommandLine cfg.master.earlyOptions} master ${makeCommandLine cfg.master.options}";
User = "seaweedfs-master"; User = "seaweedfs-master";
Group = "seaweedfs"; Group = "seaweedfs";
DynamicUser = true; DynamicUser = true;
@ -197,7 +215,7 @@ in {
(config.environment.etc."seaweedfs/security.toml".source) (config.environment.etc."seaweedfs/security.toml".source)
]; ];
serviceConfig = { serviceConfig = {
ExecStart = "${cfg.volume.package}/bin/weed volume ${makeCommandLine cfg.volume.options}"; ExecStart = "${cfg.volume.package}/bin/weed ${makeCommandLine cfg.volume.earlyOptions} volume ${makeCommandLine cfg.volume.options}";
User = "seaweedfs-volume"; User = "seaweedfs-volume";
Group = "seaweedfs"; Group = "seaweedfs";
DynamicUser = true; DynamicUser = true;