Compare commits

...

13 commits

Author SHA1 Message Date
Denis Manherz 426c5d444a Update 2023-11-27 18:06:14 +01:00
Denis Manherz 1eb7223715 Revert "Update"
This reverts commit d896b23f48.
2023-11-27 18:03:04 +01:00
Denis Manherz d896b23f48 Update 2023-11-27 17:59:48 +01:00
Denis Manherz b5f9fb6f0d Update 2023-11-27 17:54:32 +01:00
Denis Manherz 902151b0ad Update 2023-11-27 15:22:38 +01:00
Denis Manherz d6a880fefb Update 2023-11-27 15:20:37 +01:00
Denis Manherz 3122edf0c9 Update 2023-11-27 15:00:36 +01:00
Denis Manherz 201072da3d Update 2023-11-27 15:00:06 +01:00
Denis Manherz 811b606bac Update 2023-11-27 14:58:33 +01:00
Denis Manherz b6f8ee2420 Update 2023-11-27 14:56:07 +01:00
Denis Manherz b1aa03d201 Update 2023-11-27 14:38:19 +01:00
Denis Manherz 0e22c503ac Update 2023-11-27 14:37:04 +01:00
Denis Manherz 9ff54ac634 Update 2023-11-27 14:35:19 +01:00

View file

@ -51,11 +51,11 @@ in
]);
in attrsOf (either atom (listOf atom));
options = {
listen = mkOption {
description = "Launch gradio with 0.0.0.0 as server name, allowing to respond to network requests.";
default = false;
type = types.bool;
};
#listen = mkOption {
# description = "Launch gradio with 0.0.0.0 as server name, allowing to respond to network requests.";
# default = false;
# type = types.bool;
#};
port = mkOption {
description = "Launch gradio with given server port, you need root/admin rights for ports < 1024; defaults to 7860 if available.";
@ -68,6 +68,12 @@ in
default = "/var/lib/a1111";
type = types.path;
};
ckpt-dir = mkOption {
description = "Path to A1111's SD models.";
default = "/var/lib/models/ckpt";
type = types.path;
};
};
};
};
@ -83,7 +89,7 @@ in
cliArgs = (flatten (mapAttrsToList (n: v:
if v == null then []
else if isBool v then [ "${optionalString v "--"n}" ]
#else if isBool v then [ "--${optionalString (!v) "no-"}${n}" ]
else if isInt v then [ "--${n}" "${toString v}" ]
else if isFloat v then [ "--${n}" "${floatToString v}" ]
else if isString v then ["--${n}" v ]
@ -105,20 +111,21 @@ in
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
environment = {
HOME = "${cfg.settings.root}/.home";
HOME = "${cfg.settings.data-dir}/.home";
COMMANDLINE_ARGS = escapeShellArgs cliArgs;
NIXIFIED_AI_NONINTERACTIVE = "1";
};
serviceConfig = {
User = cfg.user;
Group = cfg.group;
ExecStart = "${getExe cfg.package} ${escapeShellArgs cliArgs}";
ExecStart = "${getExe cfg.package}";
PrivateTmp = true;
};
};
systemd.tmpfiles.rules = [
"d '${cfg.settings.root}' 0755 ${cfg.user} ${cfg.group} - -"
"d '${cfg.settings.root}/configs' 0755 ${cfg.user} ${cfg.group} - -"
"d '${cfg.settings.root}/.home' 0750 ${cfg.user} ${cfg.group} - -"
"d '${cfg.settings.data-dir}/' 0755 ${cfg.user} ${cfg.group} - -"
"d '${cfg.settings.data-dir}/configs' 0755 ${cfg.user} ${cfg.group} - -"
"d '${cfg.settings.data-dir}/.home' 0750 ${cfg.user} ${cfg.group} - -"
];
};
}