comfyui mostly done

This commit is contained in:
atagen 2024-10-18 14:16:35 +11:00
parent ca53366fd0
commit 58243274cd
23 changed files with 1148 additions and 114 deletions

44
flakes/ComfyUI/module.nix Normal file
View file

@ -0,0 +1,44 @@
{
pkgs,
lib,
config,
...
}: let
inherit (lib) mkEnableOption mkOption types hasSuffix;
cfg = config.programs.comfyui;
# comfyui only understands the path properly with a trailing slash
getStorage =
if (hasSuffix "/" cfg.storage)
then cfg.storage
else cfg.storage + "/";
in {
options.programs.comfyui = {
enable = mkEnableOption "ComfyUI";
storage = mkOption {
type = types.path;
description = "where to source models and store information";
};
plugins = mkOption {
type = with types; listOf package;
description = "list of comfyui plugins";
};
};
config = lib.mkIf cfg.enable {
home.packages = [
(pkgs.comfyui.override {
comfy_dir = getStorage;
plugins = cfg.plugins;
})
];
home.file = builtins.listToAttrs (map (
pkg: {
name = "${getStorage}/custom_nodes/${pkg.name}";
value = {
recursive = true;
source = "${pkg}";
};
}
)
cfg.plugins);
};
}