Update flake.nix

This commit is contained in:
Adrian Gunnar Lauterer 2024-05-29 17:31:59 +02:00
parent dcc5cac9e3
commit 671a28d9f5
1 changed files with 37 additions and 37 deletions

View File

@ -30,45 +30,45 @@
}); });
nixosModules = forAllSystems (system: let nixosModules = forAllSystems (system: let
ozaiWebui = import ./default.nix { inherit (pkgs.${system}) pkgs; }; ozai-webui = import ./default.nix { inherit (pkgs.${system}) pkgs; };
lib = pkgs.${system}.lib; lib = pkgs.${system}.lib;
types = pkgs.${system}.lib.types; types = pkgs.${system}.lib.types;
in { in {
ozai-webui = { config, pkgs, ... }: { ozai-webui = { config, pkgs, ... }: {
options.services.ozai-webui = { options.services.ozai-webui = {
enable = lib.mkEnableOption "Ozai WebUI"; enable = lib.mkEnableOption "Ozai WebUI";
host = lib.mkOption { host = lib.mkOption {
type = types.str; type = types.str;
default = "127.0.0.1"; default = "127.0.0.1";
description = "The host to run the server on"; description = "The host to run the server on";
}; };
port = lib.mkOption { port = lib.mkOption {
type = types.int; type = types.int;
default = 8080; default = 8080;
description = "The port to run the server on"; description = "The port to run the server on";
}; };
ozaiUrl = lib.mkOption { ozaiUrl = lib.mkOption {
type = types.str; type = types.str;
default = "http://localhost:8000/api/"; default = "http://localhost:8000/api/";
description = "The URL of the Ozai server"; description = "The URL of the Ozai server";
}; };
secretKey = lib.mkOption { secretKey = lib.mkOption {
type = types.str; type = types.str;
default = "secret_key"; default = "secret_key";
description = "The secret key for the Flask app"; description = "The secret key for the Flask app";
}; };
}; };
config = lib.mkIf config.services.ozai-webui.enable { config = lib.mkIf config.services.ozai-webui.enable {
systemd.services.ozai-webui = { systemd.services.ozai-webui = {
description = "Ozai WebUI"; description = "Ozai WebUI";
after = [ "network.target" ]; after = [ "network.target" ];
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
serviceConfig = { serviceConfig = {
ExecStart = "${ozaiWebui}/bin/ozai-webui --port ${toString config.services.ozai-webui.port} --host '${config.services.ozai-webui.host}' --ozai_url '${config.services.ozai-webui.ozaiUrl}' --secret_key '${config.services.ozai-webui.secretKey}' --static_folder '/share/ozai-webui/static' --template_folder '/share/ozai-webui/templates'"; ExecStart = "${ozaiWebui}/bin/ozai-webui --port ${toString config.services.ozai-webui.port} --host '${config.services.ozai-webui.host}' --ozai_url '${config.services.ozai-webui.ozaiUrl}' --secret_key '${config.services.ozai-webui.secretKey}' --static_folder '/share/ozai-webui/static' --template_folder '/share/ozai-webui/templates'";
Restart = "always"; Restart = "always";
};
}; };
}; };
};
}; };
}); });