Compare commits

...

8 commits

Author SHA1 Message Date
Nick
e8969ab837 feat: added comfy ui 2025-07-19 21:16:51 -05:00
Nick
4051afa41a feat: added comfy ui 2025-07-19 20:10:14 -05:00
Nick
7a087f91bb feat: added comfy ui 2025-07-19 19:11:24 -05:00
Nick
6c17093c30 feat: added comfy ui 2025-07-19 19:09:02 -05:00
Nick
faf32125cd feat: added comfy ui 2025-07-19 19:08:22 -05:00
Nick
be42ee2e3a feat: added comfy ui 2025-07-19 19:06:30 -05:00
Nick
ee68cdee72 feat: added comfy ui 2025-07-19 19:06:11 -05:00
Nick
758f235736 feat: added comfy ui 2025-07-19 19:02:02 -05:00
4 changed files with 272 additions and 131 deletions

219
flake.lock generated
View file

@ -277,48 +277,6 @@
} }
}, },
"flake-parts_3": { "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": { "inputs": {
"nixpkgs-lib": [ "nixpkgs-lib": [
"nur", "nur",
@ -398,7 +356,24 @@
}, },
"flake-utils_4": { "flake-utils_4": {
"inputs": { "inputs": {
"systems": "systems_7" "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"
}, },
"locked": { "locked": {
"lastModified": 1731533236, "lastModified": 1731533236,
@ -564,28 +539,6 @@
"type": "github" "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": { "home-manager": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@ -1126,23 +1079,45 @@
"type": "github" "type": "github"
} }
}, },
"nixified-ai": { "nix-comfyui": {
"inputs": { "inputs": {
"flake-parts": "flake-parts_3", "flake-utils": "flake-utils_4",
"hercules-ci-effects": "hercules-ci-effects_2", "nixpkgs": "nixpkgs_3",
"nixpkgs": "nixpkgs_3" "poetry2nix": "poetry2nix"
}, },
"locked": { "locked": {
"lastModified": 1747142274, "lastModified": 1733961600,
"narHash": "sha256-5WuEIrM4yTSMMoxJHQ9RBwO0liBE9KcCldyiBfcYIHU=", "narHash": "sha256-kEM0Dck4K4dg9QYmdldy62av+XzsNz9XhfTAhtGWwzo=",
"owner": "nixified-ai", "owner": "dyscorv",
"repo": "flake", "repo": "nix-comfyui",
"rev": "ba83e9b493f5fd278abe8ee91040323296da3f39", "rev": "cbd17e10b53dcf8fd9f5ba6f3c1ea1a550082659",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "nixified-ai", "owner": "dyscorv",
"repo": "flake", "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",
"type": "github" "type": "github"
} }
}, },
@ -1230,18 +1205,16 @@
}, },
"nixpkgs_3": { "nixpkgs_3": {
"locked": { "locked": {
"lastModified": 1734424634, "lastModified": 1733749988,
"narHash": "sha256-cHar1vqHOOyC7f1+tVycPoWTfKIaqkoe1Q6TnKzuti4=", "narHash": "sha256-+5qdtgXceqhK5ZR1YbP1fAUsweBIrhL38726oIEAtDs=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "d3c42f187194c26d9f0309a8ecc469d6c878ce33", "rev": "bc27f0fde01ce4e1bfec1ab122d72b7380278e68",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "NixOS", "id": "nixpkgs",
"ref": "nixos-unstable", "type": "indirect"
"repo": "nixpkgs",
"type": "github"
} }
}, },
"nixpkgs_4": { "nixpkgs_4": {
@ -1294,11 +1267,11 @@
}, },
"nur": { "nur": {
"inputs": { "inputs": {
"flake-parts": "flake-parts_5", "flake-parts": "flake-parts_3",
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs"
], ],
"treefmt-nix": "treefmt-nix_2" "treefmt-nix": "treefmt-nix_3"
}, },
"locked": { "locked": {
"lastModified": 1749427072, "lastModified": 1749427072,
@ -1314,6 +1287,37 @@
"type": "github" "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": { "pre-commit-hooks": {
"inputs": { "inputs": {
"flake-compat": "flake-compat_2", "flake-compat": "flake-compat_2",
@ -1434,13 +1438,13 @@
"lix-module": "lix-module", "lix-module": "lix-module",
"ngipkgs": "ngipkgs", "ngipkgs": "ngipkgs",
"niri": "niri", "niri": "niri",
"nixified-ai": "nixified-ai", "nix-comfyui": "nix-comfyui",
"nixos-cosmic": "nixos-cosmic", "nixos-cosmic": "nixos-cosmic",
"nixpkgs": "nixpkgs_5", "nixpkgs": "nixpkgs_5",
"nur": "nur", "nur": "nur",
"pre-commit-hooks-nix": "pre-commit-hooks-nix", "pre-commit-hooks-nix": "pre-commit-hooks-nix",
"sops-nix": "sops-nix_2", "sops-nix": "sops-nix_2",
"systems": "systems_6", "systems": "systems_7",
"waybar": "waybar", "waybar": "waybar",
"yazi": "yazi", "yazi": "yazi",
"zed-editor": "zed-editor", "zed-editor": "zed-editor",
@ -1671,6 +1675,21 @@
} }
}, },
"systems_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": { "locked": {
"lastModified": 1680978846, "lastModified": 1680978846,
"narHash": "sha256-Gtqg8b/v49BFDpDetjclCYXm8mAnTrUzR0JnE2nv5aw=", "narHash": "sha256-Gtqg8b/v49BFDpDetjclCYXm8mAnTrUzR0JnE2nv5aw=",
@ -1685,7 +1704,7 @@
"type": "github" "type": "github"
} }
}, },
"systems_7": { "systems_8": {
"locked": { "locked": {
"lastModified": 1681028828, "lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
@ -1723,6 +1742,28 @@
} }
}, },
"treefmt-nix_2": { "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": { "inputs": {
"nixpkgs": [ "nixpkgs": [
"nur", "nur",
@ -1840,7 +1881,7 @@
}, },
"yazi": { "yazi": {
"inputs": { "inputs": {
"flake-utils": "flake-utils_4", "flake-utils": "flake-utils_5",
"nixpkgs": "nixpkgs_6", "nixpkgs": "nixpkgs_6",
"rust-overlay": "rust-overlay_3" "rust-overlay": "rust-overlay_3"
}, },

View file

@ -62,7 +62,7 @@
url = "gitlab:InvraNet/zen-flake"; url = "gitlab:InvraNet/zen-flake";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
nixified-ai.url = "github:nixified-ai/flake"; nix-comfyui.url = "github:dyscorv/nix-comfyui";
}; };
outputs = outputs =
inputs: inputs:
@ -129,7 +129,6 @@
# inputs.ngipkgs.nixosModules."services.peertube" # inputs.ngipkgs.nixosModules."services.peertube"
# inputs.ngipkgs.nixosModules.default # inputs.ngipkgs.nixosModules.default
inputs.sops-nix.nixosModules.sops inputs.sops-nix.nixosModules.sops
inputs.nixified-ai.nixosModules.comfyui
]; ];
}; };
templates = { templates = {

114
modules/nixos/services/comfyui/default.nix Executable file → Normal file
View file

@ -1,56 +1,90 @@
{ {
config, config,
lib,
pkgs, pkgs,
flake, flake,
... ...
}: }:
let let
inherit (flake.config.machines.devices) ceres;
inherit (flake.config.services.instances) comfyui web;
inherit (flake.config.people) user0; inherit (flake.config.people) user0;
service = comfyui; cfg = config.services.comfyui;
localhost = web.localhost.address1;
in in
{ {
imports = [ ];
services.comfyui = { options = {
enable = true; services.comfyui = with lib; {
# package = pkgs.comfyui-nvidia; enable = mkEnableOption "ComfyUI service";
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
# ;
# };
};
fileSystems."/var/lib/${service.name}" = {
device = service.paths.path0;
fsType = "none";
options = [
"bind"
];
depends = [
ceres.storage0.mount
];
};
systemd.tmpfiles.rules = [ package = mkOption {
"Z ${service.paths.path0} 755 ${service.name} ${service.name} -" 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";
};
networking = { port = mkOption {
firewall = { type = types.port;
allowedTCPPorts = [ default = 8188;
service.ports.port0 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";
};
}; };
}; };
config = lib.mkIf cfg.enable {
environment.systemPackages = [ cfg.package ];
networking.firewall = lib.mkIf cfg.openFirewall {
allowedTCPPorts = [ cfg.port ];
};
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 = { };
};
} }

View file

@ -0,0 +1,67 @@
{
config,
pkgs,
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
];
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} -"
# "Z ${service.sops.path0} 755 ${service.name} ${service.name} -"
# ];
users.users.${service.name}.extraGroups = [
"users"
];
networking = {
firewall = {
allowedTCPPorts = [
service.ports.port0
];
};
};
}