From b94b8b2ba4f4a1c30cda125e18148bdd284275cb Mon Sep 17 00:00:00 2001 From: Nick Date: Fri, 18 Jul 2025 17:21:16 -0500 Subject: [PATCH 01/20] feat: added comfy ui --- modules/nixos/services/comfyui/default.nix | 83 ++++++++++------------ 1 file changed, 37 insertions(+), 46 deletions(-) diff --git a/modules/nixos/services/comfyui/default.nix b/modules/nixos/services/comfyui/default.nix index 802eb49..1679abd 100644 --- a/modules/nixos/services/comfyui/default.nix +++ b/modules/nixos/services/comfyui/default.nix @@ -9,42 +9,48 @@ let cfg = config.services.comfyui; in { - options.services.comfyui = with lib; { - enable = mkEnableOption "ComfyUI service"; + imports = [ ]; - package = mkOption { - type = types.package; - default = pkgs.comfyuiPackages.comfyui.override { - extensions = with pkgs.comfyuiPackages.extensions; [ - acly-inpaint - acly-tooling - cubiq-ipadapter-plus - fannovel16-controlnet-aux - ]; - commandLineArgs = [ - "--preview-method" - "auto" - ]; + options = { + services.comfyui = with lib; { + enable = mkEnableOption "ComfyUI service"; + + package = mkOption { + type = types.package; + default = pkgs.comfyuiPackages.comfyui.override { + extensions = with pkgs.comfyuiPackages.extensions; [ + # Add desired extensions here + # Example extensions: + # acly-inpaint + # acly-tooling + # cubiq-ipadapter-plus + # fannovel16-controlnet-aux + ]; + commandLineArgs = [ + "--preview-method" + "auto" + ]; + }; + description = "The ComfyUI package to use"; }; - description = "The ComfyUI package to use"; - }; - port = mkOption { - type = types.port; - default = 8188; - description = "Port to listen on"; - }; + port = mkOption { + type = types.port; + default = 8188; + description = "Port to listen on"; + }; - host = mkOption { - type = types.str; - default = "0.0.0.0"; - description = "Host to bind to"; - }; + host = mkOption { + type = types.str; + default = "127.0.0.1"; + description = "Host to bind to"; + }; - openFirewall = mkOption { - type = types.bool; - default = false; - description = "Open ports in the firewall"; + openFirewall = mkOption { + type = types.bool; + default = false; + description = "Open ports in the firewall"; + }; }; }; @@ -79,19 +85,4 @@ in users.groups.comfyui = { }; }; - services.comfyui = { - enable = true; - package = pkgs.comfyuiPackages.comfyui.override { - extensions = with pkgs.comfyuiPackages.extensions; [ - acly-inpaint - acly-tooling - cubiq-ipadapter-plus - fannovel16-controlnet-aux - ]; - commandLineArgs = [ - "--preview-method" - "auto" - ]; - }; - }; } From e11c0a06a163d2d9d1d1c9cd8a8cc14bf1da0243 Mon Sep 17 00:00:00 2001 From: Nick Date: Fri, 18 Jul 2025 17:23:57 -0500 Subject: [PATCH 02/20] feat: added comfy ui --- systems/ceres/config/comfyui.nix | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 systems/ceres/config/comfyui.nix diff --git a/systems/ceres/config/comfyui.nix b/systems/ceres/config/comfyui.nix new file mode 100644 index 0000000..7fdc26d --- /dev/null +++ b/systems/ceres/config/comfyui.nix @@ -0,0 +1,20 @@ +{ config, pkgs, ... }: +{ + services.comfyui = { + enable = true; + openFirewall = true; + host = "0.0.0.0"; # Allow external connections + package = pkgs.comfyuiPackages.comfyui.override { + extensions = with pkgs.comfyuiPackages.extensions; [ + acly-inpaint + acly-tooling + cubiq-ipadapter-plus + fannovel16-controlnet-aux + ]; + commandLineArgs = [ + "--preview-method" + "auto" + ]; + }; + }; +} From 2085a2de546ae64657068964b3e5513e1dad052a Mon Sep 17 00:00:00 2001 From: Nick Date: Fri, 18 Jul 2025 17:26:31 -0500 Subject: [PATCH 03/20] feat: added comfy ui --- systems/ceres/config/comfyui.nix | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/systems/ceres/config/comfyui.nix b/systems/ceres/config/comfyui.nix index 7fdc26d..a652cc8 100644 --- a/systems/ceres/config/comfyui.nix +++ b/systems/ceres/config/comfyui.nix @@ -1,5 +1,14 @@ -{ config, pkgs, ... }: { + config, + pkgs, + flake, + ... +}: +{ + nixpkgs.overlays = [ + flake.inputs.nix-comfyui.overlays.default + ]; + services.comfyui = { enable = true; openFirewall = true; From 47dd4e52e549202bfe3b26167b95d7f973013496 Mon Sep 17 00:00:00 2001 From: Nick Date: Fri, 18 Jul 2025 18:17:26 -0500 Subject: [PATCH 04/20] feat: added comfy ui --- modules/config/instances/config/comfyui.nix | 33 +++++++++++++++++ systems/ceres/config/comfyui.nix | 41 ++++++++++++++++++++- 2 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 modules/config/instances/config/comfyui.nix diff --git a/modules/config/instances/config/comfyui.nix b/modules/config/instances/config/comfyui.nix new file mode 100644 index 0000000..b476b6f --- /dev/null +++ b/modules/config/instances/config/comfyui.nix @@ -0,0 +1,33 @@ +{ moduleFunctions }: +let + inherit (moduleFunctions.instancesFunctions) + domain3 + servicePath + sslPath + sopsPath + ; + + label = "ComfyUI"; + name = "comfyui"; +in +{ + label = label; + name = name; + short = label; + + sops = { + path0 = "${sopsPath}/${name}"; + }; + tags = [ + name + "comfy" + "ui" + ]; + paths = { + path0 = "${servicePath}/${label}"; + }; + ports = { + port0 = 8188; + }; + +} diff --git a/systems/ceres/config/comfyui.nix b/systems/ceres/config/comfyui.nix index a652cc8..3083753 100644 --- a/systems/ceres/config/comfyui.nix +++ b/systems/ceres/config/comfyui.nix @@ -4,6 +4,17 @@ flake, ... }: +let + inherit (flake.config.machines.devices) + ceres + ; + inherit (flake.config.services.instances) + comfyui + web + ; + service = comfyui; + localhost = web.localhost.address1; +in { nixpkgs.overlays = [ flake.inputs.nix-comfyui.overlays.default @@ -12,7 +23,7 @@ services.comfyui = { enable = true; openFirewall = true; - host = "0.0.0.0"; # Allow external connections + host = localhost; package = pkgs.comfyuiPackages.comfyui.override { extensions = with pkgs.comfyuiPackages.extensions; [ acly-inpaint @@ -26,4 +37,32 @@ ]; }; }; + fileSystems."/var/lib/${service.name}" = { + device = service.paths.path0; + fsType = "none"; + options = [ + "bind" + ]; + depends = [ + ceres.storage0.mount + ]; + }; + + systemd.tmpfiles.rules = [ + "Z ${service.paths.path0} 755 ${service.name} ${service.name} -" + "Z ${service.sops.path0} 755 ${service.name} ${service.name} -" + ]; + + users.users.${service.name}.extraGroups = [ + "nginx" + "caddy" + ]; + + networking = { + firewall = { + allowedTCPPorts = [ + service.ports.port0 + ]; + }; + }; } From 9b4757233dc7430c2df0b70acda98e2960c4c39c Mon Sep 17 00:00:00 2001 From: Nick Date: Fri, 18 Jul 2025 18:22:28 -0500 Subject: [PATCH 05/20] feat: added comfy ui --- modules/nixos/services/samba/default.nix | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/modules/nixos/services/samba/default.nix b/modules/nixos/services/samba/default.nix index 3a0e051..1aed976 100755 --- a/modules/nixos/services/samba/default.nix +++ b/modules/nixos/services/samba/default.nix @@ -4,12 +4,10 @@ ... }: let - inherit (flake.config.services.instances) - samba - jellyfin - audiobookshelf + inherit (flake.config.services) + instances ; - service = samba; + service = instances.samba; in { # If you ever need to start fresh, you need to add yourself to the Samba users database: @@ -20,12 +18,16 @@ in enable = true; openFirewall = true; settings = { - ${jellyfin.name} = { - path = jellyfin.paths.path0; + ${instances.jellyfin.name} = { + path = instances.jellyfin.paths.path0; writable = "true"; }; - ${audiobookshelf.name} = { - path = audiobookshelf.paths.path0; + ${instances.audiobookshelf.name} = { + path = instances.audiobookshelf.paths.path0; + writable = "true"; + }; + ${instances.comfyui.name} = { + path = instances.comfyui.paths.path0; writable = "true"; }; }; From 957069137bac1d2478279abe5106939f11ea9744 Mon Sep 17 00:00:00 2001 From: Nick Date: Fri, 18 Jul 2025 18:42:20 -0500 Subject: [PATCH 06/20] feat: added comfy ui --- modules/config/instances/config/comfyui.nix | 0 modules/nixos/services/comfyui/default.nix | 0 systems/ceres/config/comfyui.nix | 0 systems/deimos/config/filesystem.nix | 2 ++ 4 files changed, 2 insertions(+) mode change 100644 => 100755 modules/config/instances/config/comfyui.nix mode change 100644 => 100755 modules/nixos/services/comfyui/default.nix mode change 100644 => 100755 systems/ceres/config/comfyui.nix diff --git a/modules/config/instances/config/comfyui.nix b/modules/config/instances/config/comfyui.nix old mode 100644 new mode 100755 diff --git a/modules/nixos/services/comfyui/default.nix b/modules/nixos/services/comfyui/default.nix old mode 100644 new mode 100755 diff --git a/systems/ceres/config/comfyui.nix b/systems/ceres/config/comfyui.nix old mode 100644 new mode 100755 diff --git a/systems/deimos/config/filesystem.nix b/systems/deimos/config/filesystem.nix index 401c2b5..211194c 100755 --- a/systems/deimos/config/filesystem.nix +++ b/systems/deimos/config/filesystem.nix @@ -15,6 +15,7 @@ let inherit (flake.config.services.instances) jellyfin audiobookshelf + comfyui ; synologySecrets = config.sops.secrets."network/synology".path; @@ -39,6 +40,7 @@ in remoteFolders = [ audiobookshelf.name jellyfin.name + comfyui.name ]; synologyMounts = synologyDrive: { From bd358b862bc7bd9ae8587003ff5e37ca1319ff81 Mon Sep 17 00:00:00 2001 From: Nick Date: Fri, 18 Jul 2025 18:58:51 -0500 Subject: [PATCH 07/20] feat: added comfy ui --- modules/nixos/services/comfyui/default.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/nixos/services/comfyui/default.nix b/modules/nixos/services/comfyui/default.nix index 1679abd..90cb702 100755 --- a/modules/nixos/services/comfyui/default.nix +++ b/modules/nixos/services/comfyui/default.nix @@ -2,10 +2,12 @@ config, lib, pkgs, + flake, ... }: let + inherit (flake.config.people) user0; cfg = config.services.comfyui; in { From 8f36cf035da298868524b1d1fbf922e795848f4e Mon Sep 17 00:00:00 2001 From: Nick Date: Fri, 18 Jul 2025 19:01:31 -0500 Subject: [PATCH 08/20] feat: added comfy ui --- modules/nixos/services/samba/default.nix | 26 ++++++++++++++++++++++++ systems/ceres/config/comfyui.nix | 1 + 2 files changed, 27 insertions(+) diff --git a/modules/nixos/services/samba/default.nix b/modules/nixos/services/samba/default.nix index 1aed976..0ef4e66 100755 --- a/modules/nixos/services/samba/default.nix +++ b/modules/nixos/services/samba/default.nix @@ -18,17 +18,43 @@ in enable = true; openFirewall = true; settings = { + global = { + "workgroup" = "WORKGROUP"; + "server string" = "NixOS Samba Server"; + "netbios name" = "ceres"; + "security" = "user"; + "hosts allow" = "192.168.0. 127.0.0.1 localhost"; + "hosts deny" = "0.0.0.0/0"; + "guest account" = "nobody"; + "map to guest" = "bad user"; + "create mask" = "0664"; + "directory mask" = "0775"; + "force create mode" = "0664"; + "force directory mode" = "0775"; + }; ${instances.jellyfin.name} = { path = instances.jellyfin.paths.path0; writable = "true"; + "valid users" = "%wheel"; + "force group" = "users"; + "create mask" = "0664"; + "directory mask" = "0775"; }; ${instances.audiobookshelf.name} = { path = instances.audiobookshelf.paths.path0; writable = "true"; + "valid users" = "%wheel"; + "force group" = "users"; + "create mask" = "0664"; + "directory mask" = "0775"; }; ${instances.comfyui.name} = { path = instances.comfyui.paths.path0; writable = "true"; + "valid users" = "%wheel"; + "force group" = "users"; + "create mask" = "0664"; + "directory mask" = "0775"; }; }; }; diff --git a/systems/ceres/config/comfyui.nix b/systems/ceres/config/comfyui.nix index 3083753..cdac944 100755 --- a/systems/ceres/config/comfyui.nix +++ b/systems/ceres/config/comfyui.nix @@ -56,6 +56,7 @@ in users.users.${service.name}.extraGroups = [ "nginx" "caddy" + "users" ]; networking = { From 08e7a47c6a0aed522646e02ee5f3e6842f1de9c5 Mon Sep 17 00:00:00 2001 From: Nick Date: Fri, 18 Jul 2025 19:28:00 -0500 Subject: [PATCH 09/20] feat: added comfy ui --- modules/nixos/services/samba/default.nix | 26 ------------------------ 1 file changed, 26 deletions(-) diff --git a/modules/nixos/services/samba/default.nix b/modules/nixos/services/samba/default.nix index 0ef4e66..1aed976 100755 --- a/modules/nixos/services/samba/default.nix +++ b/modules/nixos/services/samba/default.nix @@ -18,43 +18,17 @@ in enable = true; openFirewall = true; settings = { - global = { - "workgroup" = "WORKGROUP"; - "server string" = "NixOS Samba Server"; - "netbios name" = "ceres"; - "security" = "user"; - "hosts allow" = "192.168.0. 127.0.0.1 localhost"; - "hosts deny" = "0.0.0.0/0"; - "guest account" = "nobody"; - "map to guest" = "bad user"; - "create mask" = "0664"; - "directory mask" = "0775"; - "force create mode" = "0664"; - "force directory mode" = "0775"; - }; ${instances.jellyfin.name} = { path = instances.jellyfin.paths.path0; writable = "true"; - "valid users" = "%wheel"; - "force group" = "users"; - "create mask" = "0664"; - "directory mask" = "0775"; }; ${instances.audiobookshelf.name} = { path = instances.audiobookshelf.paths.path0; writable = "true"; - "valid users" = "%wheel"; - "force group" = "users"; - "create mask" = "0664"; - "directory mask" = "0775"; }; ${instances.comfyui.name} = { path = instances.comfyui.paths.path0; writable = "true"; - "valid users" = "%wheel"; - "force group" = "users"; - "create mask" = "0664"; - "directory mask" = "0775"; }; }; }; From 350bf2a00d543e705058e5f555dac9dd87426216 Mon Sep 17 00:00:00 2001 From: Nick Date: Fri, 18 Jul 2025 19:33:55 -0500 Subject: [PATCH 10/20] feat: added comfy ui --- profiles/user0/default.nix | 1 + systems/ceres/config/comfyui.nix | 15 ++++----------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/profiles/user0/default.nix b/profiles/user0/default.nix index 6c49163..a274ecf 100755 --- a/profiles/user0/default.nix +++ b/profiles/user0/default.nix @@ -39,6 +39,7 @@ in "vaultwarden" "vboxusers" "wheel" + "comfyui" ]; }; }; diff --git a/systems/ceres/config/comfyui.nix b/systems/ceres/config/comfyui.nix index cdac944..0a39cb8 100755 --- a/systems/ceres/config/comfyui.nix +++ b/systems/ceres/config/comfyui.nix @@ -5,13 +5,9 @@ ... }: let - inherit (flake.config.machines.devices) - ceres - ; - inherit (flake.config.services.instances) - comfyui - web - ; + inherit (flake.config.machines.devices) ceres; + inherit (flake.config.services.instances) comfyui web; + inherit (flake.config.people) user0; service = comfyui; localhost = web.localhost.address1; in @@ -49,13 +45,10 @@ in }; systemd.tmpfiles.rules = [ - "Z ${service.paths.path0} 755 ${service.name} ${service.name} -" - "Z ${service.sops.path0} 755 ${service.name} ${service.name} -" + "Z ${service.paths.path0} 755 ${user0} ${service.name} -" ]; users.users.${service.name}.extraGroups = [ - "nginx" - "caddy" "users" ]; From 480ff8d120b53c0dd50e8d5cd50ffde2084fc4dc Mon Sep 17 00:00:00 2001 From: Nick Date: Fri, 18 Jul 2025 19:53:21 -0500 Subject: [PATCH 11/20] feat: added comfy ui --- .../bookmarks/config/flake/selfHosted.nix | 27 ++++++++++--------- systems/mars/config/filesystem.nix | 3 ++- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/modules/home/gui/apps/browsers/floorp/config/bookmarks/config/flake/selfHosted.nix b/modules/home/gui/apps/browsers/floorp/config/bookmarks/config/flake/selfHosted.nix index 7082b16..c382efa 100755 --- a/modules/home/gui/apps/browsers/floorp/config/bookmarks/config/flake/selfHosted.nix +++ b/modules/home/gui/apps/browsers/floorp/config/bookmarks/config/flake/selfHosted.nix @@ -27,23 +27,23 @@ let suffix = "(Remote)"; urlTemplate = name: "https://${instances.${name}.domains.url0}"; services = [ - "audiobookshelf" - "forgejo" - "glance" - "jellyfin" - "mastodon" - "ollama" - "opencloud" - "searx" - "vaultwarden" + instances.audiobookshelf.name + instances.forgejo.name + instances.glance.name + instances.jellyfin.name + instances.mastodon.name + instances.ollama.name + instances.opencloud.name + instances.searx.name + instances.vaultwarden.name ]; } { suffix = "(Desktop)"; urlTemplate = name: "http://${mars.ip.address0}:${builtins.toString instances.${name}.ports.port0}"; services = [ - "ollama" - "syncthing" + instances.ollama.name + instances.syncthing.name ]; } { @@ -51,7 +51,8 @@ let urlTemplate = name: "http://${ceres.ip.address0}:${builtins.toString instances.${name}.ports.port0}"; services = [ - "jellyfin" + instances.jellyfin.name + instances.comfyui.name ]; } { @@ -59,7 +60,7 @@ let urlTemplate = name: "http://${synology.ip.address0}:${builtins.toString instances.${name}.ports.port0}"; services = [ - "syncthing" + instances.syncthing.name ]; } ]; diff --git a/systems/mars/config/filesystem.nix b/systems/mars/config/filesystem.nix index 09021bb..59aabe4 100755 --- a/systems/mars/config/filesystem.nix +++ b/systems/mars/config/filesystem.nix @@ -6,7 +6,7 @@ let inherit (flake.config.people) user0 user1; inherit (flake.config.machines.devices) mars ceres synology; - inherit (flake.config.services.instances) jellyfin audiobookshelf; + inherit (flake.config.services.instances) jellyfin audiobookshelf comfyui; synologySecrets = config.sops.secrets."network/synology".path; ceresSecrets = config.sops.secrets."network/server".path; in @@ -30,6 +30,7 @@ in sambaFolders = [ audiobookshelf.name jellyfin.name + comfyui.name ]; synologyMounts = synologyDrive: { From c4f55dd01d12ff776c3353fb221cb97d069ffe1e Mon Sep 17 00:00:00 2001 From: Nick Date: Fri, 18 Jul 2025 20:40:33 -0500 Subject: [PATCH 12/20] feat: added comfy ui --- .../config/bookmarks/config/development.nix | 15 +++++++++++++++ systems/ceres/config/comfyui.nix | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/modules/home/gui/apps/browsers/floorp/config/bookmarks/config/development.nix b/modules/home/gui/apps/browsers/floorp/config/bookmarks/config/development.nix index 08f056f..2535fb3 100755 --- a/modules/home/gui/apps/browsers/floorp/config/bookmarks/config/development.nix +++ b/modules/home/gui/apps/browsers/floorp/config/bookmarks/config/development.nix @@ -20,6 +20,21 @@ in ]; keyword = "Discord"; } + { + name = "ComfyUI"; + url = "https://civitai.com"; + tags = [ + "comfyui" + "comfy" + "ui" + "stable" + "diffusion" + "ai" + "art" + "generation" + ]; + keyword = "Comfy"; + } { name = "Elm Packages"; url = "https://package.elm-lang.org/packages"; diff --git a/systems/ceres/config/comfyui.nix b/systems/ceres/config/comfyui.nix index 0a39cb8..a9ad410 100755 --- a/systems/ceres/config/comfyui.nix +++ b/systems/ceres/config/comfyui.nix @@ -45,7 +45,7 @@ in }; systemd.tmpfiles.rules = [ - "Z ${service.paths.path0} 755 ${user0} ${service.name} -" + "Z ${service.paths.path0} 755 ${service.name} ${service.name} -" ]; users.users.${service.name}.extraGroups = [ From 848426d5ec6ca6c76e433a568bb978490f7b0ce3 Mon Sep 17 00:00:00 2001 From: Nick Date: Fri, 18 Jul 2025 20:53:49 -0500 Subject: [PATCH 13/20] feat: added comfy ui --- flake.nix | 3 +- modules/nixos/services/comfyui/default.nix | 111 +++++++-------------- systems/ceres/config/comfyui.nix | 62 ------------ 3 files changed, 40 insertions(+), 136 deletions(-) delete mode 100755 systems/ceres/config/comfyui.nix diff --git a/flake.nix b/flake.nix index 3dc0d8e..629909c 100755 --- a/flake.nix +++ b/flake.nix @@ -62,7 +62,7 @@ url = "gitlab:InvraNet/zen-flake"; inputs.nixpkgs.follows = "nixpkgs"; }; - nix-comfyui.url = "github:dyscorv/nix-comfyui"; + nixified-ai.url = "github:matthewcroughan/nixified-ai"; }; outputs = inputs: @@ -129,6 +129,7 @@ # inputs.ngipkgs.nixosModules."services.peertube" # inputs.ngipkgs.nixosModules.default inputs.sops-nix.nixosModules.sops + inputs.nixified-ai.nixosModules.comfyui ]; }; templates = { diff --git a/modules/nixos/services/comfyui/default.nix b/modules/nixos/services/comfyui/default.nix index 90cb702..b2a7006 100755 --- a/modules/nixos/services/comfyui/default.nix +++ b/modules/nixos/services/comfyui/default.nix @@ -1,90 +1,55 @@ { config, - lib, pkgs, flake, ... }: - let + inherit (flake.config.machines.devices) ceres; + inherit (flake.config.services.instances) comfyui web; inherit (flake.config.people) user0; - cfg = config.services.comfyui; + service = comfyui; + localhost = web.localhost.address1; in { - imports = [ ]; + nixpkgs.overlays = [ + flake.inputs.nix-comfyui.overlays.default + ]; - options = { - services.comfyui = with lib; { - enable = mkEnableOption "ComfyUI service"; - - package = mkOption { - type = types.package; - default = pkgs.comfyuiPackages.comfyui.override { - extensions = with pkgs.comfyuiPackages.extensions; [ - # Add desired extensions here - # Example extensions: - # acly-inpaint - # acly-tooling - # cubiq-ipadapter-plus - # fannovel16-controlnet-aux - ]; - commandLineArgs = [ - "--preview-method" - "auto" - ]; - }; - description = "The ComfyUI package to use"; - }; - - port = mkOption { - type = types.port; - default = 8188; - description = "Port to listen on"; - }; - - host = mkOption { - type = types.str; - default = "127.0.0.1"; - description = "Host to bind to"; - }; - - openFirewall = mkOption { - type = types.bool; - default = false; - description = "Open ports in the firewall"; - }; - }; + services.comfyui = { + enable = true; + package = pkgs.comfyui-nvidia; + host = localhost; + models = builtins.attrValues pkgs.nixified-ai.models; + customNodes = with comfyui.pkgs; [ + comfyui-gguf + comfyui-impact-pack + ]; + }; + fileSystems."/var/lib/${service.name}" = { + device = service.paths.path0; + fsType = "none"; + options = [ + "bind" + ]; + depends = [ + ceres.storage0.mount + ]; }; - config = lib.mkIf cfg.enable { - environment.systemPackages = [ cfg.package ]; + systemd.tmpfiles.rules = [ + "Z ${service.paths.path0} 755 ${service.name} ${service.name} -" + ]; - networking.firewall = lib.mkIf cfg.openFirewall { - allowedTCPPorts = [ cfg.port ]; + users.users.${service.name}.extraGroups = [ + "users" + ]; + + networking = { + firewall = { + allowedTCPPorts = [ + service.ports.port0 + ]; }; - - systemd.services.comfyui = { - description = "ComfyUI Service"; - wantedBy = [ "multi-user.target" ]; - after = [ "network.target" ]; - - serviceConfig = { - Type = "simple"; - ExecStart = "${cfg.package}/bin/comfyui --port ${toString cfg.port} --listen ${cfg.host}"; - Restart = "on-failure"; - User = "comfyui"; - Group = "comfyui"; - WorkingDirectory = "/var/lib/comfyui"; - }; - }; - - users.users.comfyui = { - group = "comfyui"; - isSystemUser = true; - home = "/var/lib/comfyui"; - createHome = true; - }; - - users.groups.comfyui = { }; }; } diff --git a/systems/ceres/config/comfyui.nix b/systems/ceres/config/comfyui.nix deleted file mode 100755 index a9ad410..0000000 --- a/systems/ceres/config/comfyui.nix +++ /dev/null @@ -1,62 +0,0 @@ -{ - config, - pkgs, - flake, - ... -}: -let - inherit (flake.config.machines.devices) ceres; - inherit (flake.config.services.instances) comfyui web; - inherit (flake.config.people) user0; - service = comfyui; - localhost = web.localhost.address1; -in -{ - nixpkgs.overlays = [ - flake.inputs.nix-comfyui.overlays.default - ]; - - services.comfyui = { - enable = true; - openFirewall = true; - host = localhost; - package = pkgs.comfyuiPackages.comfyui.override { - extensions = with pkgs.comfyuiPackages.extensions; [ - acly-inpaint - acly-tooling - cubiq-ipadapter-plus - fannovel16-controlnet-aux - ]; - commandLineArgs = [ - "--preview-method" - "auto" - ]; - }; - }; - fileSystems."/var/lib/${service.name}" = { - device = service.paths.path0; - fsType = "none"; - options = [ - "bind" - ]; - depends = [ - ceres.storage0.mount - ]; - }; - - systemd.tmpfiles.rules = [ - "Z ${service.paths.path0} 755 ${service.name} ${service.name} -" - ]; - - users.users.${service.name}.extraGroups = [ - "users" - ]; - - networking = { - firewall = { - allowedTCPPorts = [ - service.ports.port0 - ]; - }; - }; -} From fd9c10bc0854ca93287e6ab3f88743dbdbf2edfb Mon Sep 17 00:00:00 2001 From: Nick Date: Fri, 18 Jul 2025 21:15:35 -0500 Subject: [PATCH 14/20] feat: added comfy ui --- flake.lock | 219 ++++++++++++++++++++++------------------------------- flake.nix | 2 +- 2 files changed, 90 insertions(+), 131 deletions(-) diff --git a/flake.lock b/flake.lock index c111c28..850dbc4 100755 --- a/flake.lock +++ b/flake.lock @@ -277,6 +277,48 @@ } }, "flake-parts_3": { + "inputs": { + "nixpkgs-lib": [ + "nixified-ai", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1733312601, + "narHash": "sha256-4pDvzqnegAfRkPwO3wmwBhVi/Sye1mzps0zHWYnP88c=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "205b12d8b7cd4802fbcb8e8ef6a0f1408781a4f9", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_4": { + "inputs": { + "nixpkgs-lib": [ + "nixified-ai", + "hercules-ci-effects", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1733312601, + "narHash": "sha256-4pDvzqnegAfRkPwO3wmwBhVi/Sye1mzps0zHWYnP88c=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "205b12d8b7cd4802fbcb8e8ef6a0f1408781a4f9", + "type": "github" + }, + "original": { + "id": "flake-parts", + "type": "indirect" + } + }, + "flake-parts_5": { "inputs": { "nixpkgs-lib": [ "nur", @@ -356,24 +398,7 @@ }, "flake-utils_4": { "inputs": { - "systems": "systems_6" - }, - "locked": { - "lastModified": 1731533236, - "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", - "type": "github" - }, - "original": { - "id": "flake-utils", - "type": "indirect" - } - }, - "flake-utils_5": { - "inputs": { - "systems": "systems_8" + "systems": "systems_7" }, "locked": { "lastModified": 1731533236, @@ -539,6 +564,28 @@ "type": "github" } }, + "hercules-ci-effects_2": { + "inputs": { + "flake-parts": "flake-parts_4", + "nixpkgs": [ + "nixified-ai", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1733333617, + "narHash": "sha256-nMMQXREGvLOLvUa0ByhYFdaL0Jov0t1wzLbKjr05P2w=", + "owner": "hercules-ci", + "repo": "hercules-ci-effects", + "rev": "56f8ea8d502c87cf62444bec4ee04512e8ea24ea", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "hercules-ci-effects", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -1079,45 +1126,23 @@ "type": "github" } }, - "nix-comfyui": { + "nixified-ai": { "inputs": { - "flake-utils": "flake-utils_4", - "nixpkgs": "nixpkgs_3", - "poetry2nix": "poetry2nix" + "flake-parts": "flake-parts_3", + "hercules-ci-effects": "hercules-ci-effects_2", + "nixpkgs": "nixpkgs_3" }, "locked": { - "lastModified": 1733961600, - "narHash": "sha256-kEM0Dck4K4dg9QYmdldy62av+XzsNz9XhfTAhtGWwzo=", - "owner": "dyscorv", - "repo": "nix-comfyui", - "rev": "cbd17e10b53dcf8fd9f5ba6f3c1ea1a550082659", + "lastModified": 1747142274, + "narHash": "sha256-5WuEIrM4yTSMMoxJHQ9RBwO0liBE9KcCldyiBfcYIHU=", + "owner": "nixified-ai", + "repo": "flake", + "rev": "ba83e9b493f5fd278abe8ee91040323296da3f39", "type": "github" }, "original": { - "owner": "dyscorv", - "repo": "nix-comfyui", - "type": "github" - } - }, - "nix-github-actions": { - "inputs": { - "nixpkgs": [ - "nix-comfyui", - "poetry2nix", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1729742964, - "narHash": "sha256-B4mzTcQ0FZHdpeWcpDYPERtyjJd/NIuaQ9+BV1h+MpA=", - "owner": "nix-community", - "repo": "nix-github-actions", - "rev": "e04df33f62cdcf93d73e9a04142464753a16db67", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "nix-github-actions", + "owner": "nixified-ai", + "repo": "flake", "type": "github" } }, @@ -1205,16 +1230,18 @@ }, "nixpkgs_3": { "locked": { - "lastModified": 1733749988, - "narHash": "sha256-+5qdtgXceqhK5ZR1YbP1fAUsweBIrhL38726oIEAtDs=", + "lastModified": 1734424634, + "narHash": "sha256-cHar1vqHOOyC7f1+tVycPoWTfKIaqkoe1Q6TnKzuti4=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "bc27f0fde01ce4e1bfec1ab122d72b7380278e68", + "rev": "d3c42f187194c26d9f0309a8ecc469d6c878ce33", "type": "github" }, "original": { - "id": "nixpkgs", - "type": "indirect" + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" } }, "nixpkgs_4": { @@ -1267,11 +1294,11 @@ }, "nur": { "inputs": { - "flake-parts": "flake-parts_3", + "flake-parts": "flake-parts_5", "nixpkgs": [ "nixpkgs" ], - "treefmt-nix": "treefmt-nix_3" + "treefmt-nix": "treefmt-nix_2" }, "locked": { "lastModified": 1749427072, @@ -1287,37 +1314,6 @@ "type": "github" } }, - "poetry2nix": { - "inputs": { - "flake-utils": [ - "nix-comfyui", - "flake-utils" - ], - "nix-github-actions": "nix-github-actions", - "nixpkgs": [ - "nix-comfyui", - "nixpkgs" - ], - "systems": [ - "nix-comfyui", - "flake-utils", - "systems" - ], - "treefmt-nix": "treefmt-nix_2" - }, - "locked": { - "lastModified": 1731205797, - "narHash": "sha256-F7N1mxH1VrkVNHR3JGNMRvp9+98KYO4b832KS8Gl2xI=", - "owner": "nix-community", - "repo": "poetry2nix", - "rev": "f554d27c1544d9c56e5f1f8e2b8aff399803674e", - "type": "github" - }, - "original": { - "id": "poetry2nix", - "type": "indirect" - } - }, "pre-commit-hooks": { "inputs": { "flake-compat": "flake-compat_2", @@ -1438,13 +1434,13 @@ "lix-module": "lix-module", "ngipkgs": "ngipkgs", "niri": "niri", - "nix-comfyui": "nix-comfyui", + "nixified-ai": "nixified-ai", "nixos-cosmic": "nixos-cosmic", "nixpkgs": "nixpkgs_5", "nur": "nur", "pre-commit-hooks-nix": "pre-commit-hooks-nix", "sops-nix": "sops-nix_2", - "systems": "systems_7", + "systems": "systems_6", "waybar": "waybar", "yazi": "yazi", "zed-editor": "zed-editor", @@ -1675,21 +1671,6 @@ } }, "systems_6": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, - "systems_7": { "locked": { "lastModified": 1680978846, "narHash": "sha256-Gtqg8b/v49BFDpDetjclCYXm8mAnTrUzR0JnE2nv5aw=", @@ -1704,7 +1685,7 @@ "type": "github" } }, - "systems_8": { + "systems_7": { "locked": { "lastModified": 1681028828, "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", @@ -1742,28 +1723,6 @@ } }, "treefmt-nix_2": { - "inputs": { - "nixpkgs": [ - "nix-comfyui", - "poetry2nix", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1730120726, - "narHash": "sha256-LqHYIxMrl/1p3/kvm2ir925tZ8DkI0KA10djk8wecSk=", - "owner": "numtide", - "repo": "treefmt-nix", - "rev": "9ef337e492a5555d8e17a51c911ff1f02635be15", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "treefmt-nix", - "type": "github" - } - }, - "treefmt-nix_3": { "inputs": { "nixpkgs": [ "nur", @@ -1881,7 +1840,7 @@ }, "yazi": { "inputs": { - "flake-utils": "flake-utils_5", + "flake-utils": "flake-utils_4", "nixpkgs": "nixpkgs_6", "rust-overlay": "rust-overlay_3" }, diff --git a/flake.nix b/flake.nix index 629909c..fb166fa 100755 --- a/flake.nix +++ b/flake.nix @@ -62,7 +62,7 @@ url = "gitlab:InvraNet/zen-flake"; inputs.nixpkgs.follows = "nixpkgs"; }; - nixified-ai.url = "github:matthewcroughan/nixified-ai"; + nixified-ai.url = "github:nixified-ai/flake"; }; outputs = inputs: From 91863080f7bddbc8fb655d4877cff490acb3bf73 Mon Sep 17 00:00:00 2001 From: Nick Date: Fri, 18 Jul 2025 21:17:16 -0500 Subject: [PATCH 15/20] feat: added comfy ui --- modules/nixos/services/comfyui/default.nix | 3 --- 1 file changed, 3 deletions(-) diff --git a/modules/nixos/services/comfyui/default.nix b/modules/nixos/services/comfyui/default.nix index b2a7006..cd3e299 100755 --- a/modules/nixos/services/comfyui/default.nix +++ b/modules/nixos/services/comfyui/default.nix @@ -12,9 +12,6 @@ let localhost = web.localhost.address1; in { - nixpkgs.overlays = [ - flake.inputs.nix-comfyui.overlays.default - ]; services.comfyui = { enable = true; From dfe35144e46ce23ef46d55ef2f55b8307fe2abb7 Mon Sep 17 00:00:00 2001 From: Nick Date: Fri, 18 Jul 2025 21:18:14 -0500 Subject: [PATCH 16/20] feat: added comfy ui --- modules/nixos/services/comfyui/default.nix | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/modules/nixos/services/comfyui/default.nix b/modules/nixos/services/comfyui/default.nix index cd3e299..27a238f 100755 --- a/modules/nixos/services/comfyui/default.nix +++ b/modules/nixos/services/comfyui/default.nix @@ -35,11 +35,7 @@ in }; systemd.tmpfiles.rules = [ - "Z ${service.paths.path0} 755 ${service.name} ${service.name} -" - ]; - - users.users.${service.name}.extraGroups = [ - "users" + "Z ${service.paths.path0} 755 ${user0} users -" ]; networking = { From bc7fa56e3cee4537176176895440d365067758c0 Mon Sep 17 00:00:00 2001 From: Nick Date: Fri, 18 Jul 2025 21:18:52 -0500 Subject: [PATCH 17/20] feat: added comfy ui --- modules/nixos/services/comfyui/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/nixos/services/comfyui/default.nix b/modules/nixos/services/comfyui/default.nix index 27a238f..85afcdf 100755 --- a/modules/nixos/services/comfyui/default.nix +++ b/modules/nixos/services/comfyui/default.nix @@ -15,7 +15,7 @@ in services.comfyui = { enable = true; - package = pkgs.comfyui-nvidia; + # package = pkgs.comfyui-nvidia; host = localhost; models = builtins.attrValues pkgs.nixified-ai.models; customNodes = with comfyui.pkgs; [ From 4a0ce7226f2334414d1c980c51baeb4e3bfd3519 Mon Sep 17 00:00:00 2001 From: Nick Date: Fri, 18 Jul 2025 21:27:04 -0500 Subject: [PATCH 18/20] feat: added comfy ui --- modules/nixos/services/comfyui/default.nix | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/modules/nixos/services/comfyui/default.nix b/modules/nixos/services/comfyui/default.nix index 85afcdf..c965771 100755 --- a/modules/nixos/services/comfyui/default.nix +++ b/modules/nixos/services/comfyui/default.nix @@ -15,13 +15,21 @@ in services.comfyui = { enable = true; - # package = pkgs.comfyui-nvidia; + package = pkgs.comfyui-nvidia; host = localhost; - models = builtins.attrValues pkgs.nixified-ai.models; - customNodes = with comfyui.pkgs; [ - comfyui-gguf - comfyui-impact-pack - ]; + user = service.name; + acceleration = "cuda"; + models = builtins.attrValues { + inherit (pkgs.nixified-ai) + models + ; + }; + customNodes = builtins.attrValues { + inherit (comfyui.pkgs) + comfyui-gguf + comfyui-impact-pack + ; + }; }; fileSystems."/var/lib/${service.name}" = { device = service.paths.path0; @@ -35,7 +43,7 @@ in }; systemd.tmpfiles.rules = [ - "Z ${service.paths.path0} 755 ${user0} users -" + "Z ${service.paths.path0} 755 ${service.name} ${service.name} -" ]; networking = { From a1ce1f2508795fc11a8d1fe22857cee28700d7c1 Mon Sep 17 00:00:00 2001 From: Nick Date: Fri, 18 Jul 2025 21:28:29 -0500 Subject: [PATCH 19/20] feat: added comfy ui --- modules/nixos/services/comfyui/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/nixos/services/comfyui/default.nix b/modules/nixos/services/comfyui/default.nix index c965771..3ef57bb 100755 --- a/modules/nixos/services/comfyui/default.nix +++ b/modules/nixos/services/comfyui/default.nix @@ -15,7 +15,7 @@ in services.comfyui = { enable = true; - package = pkgs.comfyui-nvidia; + # package = pkgs.comfyui-nvidia; host = localhost; user = service.name; acceleration = "cuda"; From 02eb4737b9fd66c535a5fcfd5397045ced161664 Mon Sep 17 00:00:00 2001 From: Nick Date: Fri, 18 Jul 2025 21:29:20 -0500 Subject: [PATCH 20/20] feat: added comfy ui --- modules/nixos/services/comfyui/default.nix | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/modules/nixos/services/comfyui/default.nix b/modules/nixos/services/comfyui/default.nix index 3ef57bb..cb8615a 100755 --- a/modules/nixos/services/comfyui/default.nix +++ b/modules/nixos/services/comfyui/default.nix @@ -19,17 +19,17 @@ in host = localhost; user = service.name; acceleration = "cuda"; - models = builtins.attrValues { - inherit (pkgs.nixified-ai) - models - ; - }; - customNodes = builtins.attrValues { - inherit (comfyui.pkgs) - comfyui-gguf - comfyui-impact-pack - ; - }; + # models = builtins.attrValues { + # inherit (pkgs.nixified-ai) + # models + # ; + # }; + # customNodes = builtins.attrValues { + # inherit (comfyui.pkgs) + # comfyui-gguf + # comfyui-impact-pack + # ; + # }; }; fileSystems."/var/lib/${service.name}" = { device = service.paths.path0;