This commit is contained in:
2025-01-02 18:18:57 +01:00
parent 3270e3fe2c
commit 626b736626
20 changed files with 794 additions and 690 deletions

View File

@ -2,17 +2,16 @@ inputs: {
config,
lib,
pkgs,
system,
...
}: let
cfg = config.testdata;
cfg = config.services.testdata;
package = inputs.self.packages.${pkgs.stdenv.hostPlatform.system}.default;
inherit (lib) mkIf mkEnableOption mkOption types;
format = pkgs.formats.json {};
configFile = format.generate "config.json" cfg.settings;
in {
options.testdata = {
options.services.testdata = {
enable = mkEnableOption "testdata";
settings = mkOption {
@ -29,7 +28,17 @@ in {
]);
in
valueType;
default = throw "Please specify testdata.settings";
default = throw "Please specify services.testdata.settings";
};
host = mkOption {
type = types.str;
default = throw "Please specify a services.testdata.port";
};
port = mkOption {
type = types.int;
default = throw "Please specify a services.testdata.port";
};
};
@ -41,7 +50,7 @@ in {
serviceConfig = {
Type = "simple";
ExecStart = "${package}/bin/testdata --config ${configFile}";
ExecStart = "${package}/bin/testdata --config ${configFile} --listen ${cfg.host} --port ${builtins.toString cfg.port}";
};
wantedBy = ["multi-user.target"];