44 lines
1 KiB
Nix
44 lines
1 KiB
Nix
{
|
|
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);
|
|
};
|
|
}
|