mirror of
https://github.com/denismhz/flake.git
synced 2025-11-09 16:16:23 +01:00
A1111 Service
This commit is contained in:
parent
1e61b8dcd5
commit
9aaf8fec27
|
|
@ -8,33 +8,33 @@ let
|
||||||
floatToString optionalString
|
floatToString optionalString
|
||||||
;
|
;
|
||||||
|
|
||||||
cfg = config.services.invokeai;
|
cfg = config.services.a1111;
|
||||||
in
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
imports = map ({ old, new ? old }: mkRenamedOptionModule [ "services" "invokeai" old ] [ "services" "invokeai" "settings" new ]) [
|
imports = map ({ old, new ? old }: mkRenamedOptionModule [ "services" "a1111" old ] [ "services" "a1111" "settings" new ]) [
|
||||||
{ old = "host"; }
|
{ old = "host"; }
|
||||||
{ old = "port"; }
|
{ old = "port"; }
|
||||||
{ old = "dataDir"; new = "root"; }
|
{ old = "dataDir"; new = "root"; }
|
||||||
{ old = "precision"; }
|
{ old = "precision"; }
|
||||||
];
|
];
|
||||||
options.services.invokeai = {
|
options.services.invokeai = {
|
||||||
enable = mkEnableOption "InvokeAI Web UI for Stable Diffusion";
|
enable = mkEnableOption "Automatic1111 UI for Stable Diffusion";
|
||||||
|
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
description = "Which InvokeAI package to use.";
|
description = "Which Automatic1111 package to use.";
|
||||||
type = types.package;
|
type = types.package;
|
||||||
};
|
};
|
||||||
|
|
||||||
user = mkOption {
|
user = mkOption {
|
||||||
description = "Which user to run InvokeAI as.";
|
description = "Which user to run A1111 as.";
|
||||||
default = "invokeai";
|
default = "a1111";
|
||||||
type = types.str;
|
type = types.str;
|
||||||
};
|
};
|
||||||
|
|
||||||
group = mkOption {
|
group = mkOption {
|
||||||
description = "Which group to run InvokeAI as.";
|
description = "Which group to run A1111 as.";
|
||||||
default = "invokeai";
|
default = "a1111";
|
||||||
type = types.str;
|
type = types.str;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -52,28 +52,22 @@ in
|
||||||
in attrsOf (either atom (listOf atom));
|
in attrsOf (either atom (listOf atom));
|
||||||
options = {
|
options = {
|
||||||
host = mkOption {
|
host = mkOption {
|
||||||
description = "Which IP address to listen on.";
|
description = "Launch gradio with 0.0.0.0 as server name, allowing to respond to network requests.";
|
||||||
default = "127.0.0.1";
|
default = false;
|
||||||
type = types.str;
|
type = types.bool;
|
||||||
};
|
};
|
||||||
|
|
||||||
port = mkOption {
|
port = mkOption {
|
||||||
description = "Which port to listen on.";
|
description = "Launch gradio with given server port, you need root/admin rights for ports < 1024; defaults to 7860 if available.";
|
||||||
default = 9090;
|
default = 7860;
|
||||||
type = types.port;
|
type = types.port;
|
||||||
};
|
};
|
||||||
|
|
||||||
root = mkOption {
|
root = mkOption {
|
||||||
description = "Where to store InvokeAI's state.";
|
description = "Where to store A1111's state.";
|
||||||
default = "/var/lib/invokeai";
|
default = "/var/lib/a1111";
|
||||||
type = types.path;
|
type = types.path;
|
||||||
};
|
};
|
||||||
|
|
||||||
precision = mkOption {
|
|
||||||
description = "Set model precision.";
|
|
||||||
default = "auto";
|
|
||||||
type = types.enum [ "auto" "float32" "autocast" "float16" ];
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
@ -98,21 +92,20 @@ in
|
||||||
) cfg.settings)) ++ cfg.extraArgs;
|
) cfg.settings)) ++ cfg.extraArgs;
|
||||||
|
|
||||||
in mkIf cfg.enable {
|
in mkIf cfg.enable {
|
||||||
users.users = mkIf (cfg.user == "invokeai") {
|
users.users = mkIf (cfg.user == "a1111") {
|
||||||
invokeai = {
|
invokeai = {
|
||||||
isSystemUser = true;
|
isSystemUser = true;
|
||||||
inherit (cfg) group;
|
inherit (cfg) group;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
users.groups = mkIf (cfg.group == "invokeai") {
|
users.groups = mkIf (cfg.group == "a1111") {
|
||||||
invokeai = {};
|
a1111 = {};
|
||||||
};
|
};
|
||||||
systemd.services.invokeai = {
|
systemd.services.a1111 = {
|
||||||
after = [ "network.target" ];
|
after = [ "network.target" ];
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
environment = {
|
environment = {
|
||||||
HOME = "${cfg.settings.root}/.home";
|
HOME = "${cfg.settings.root}/.home";
|
||||||
INVOKEAI_ROOT = "${cfg.settings.root}";
|
|
||||||
NIXIFIED_AI_NONINTERACTIVE = "1";
|
NIXIFIED_AI_NONINTERACTIVE = "1";
|
||||||
};
|
};
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue