11 name = lib.strings.sanitizeDerivationName (
12 builtins.concatStringsSep "_" ([ "local-ai-models" ] ++ (builtins.attrNames configs))
18 templateName = type: name + "_" + type;
20 config' = lib.recursiveUpdate config (
24 // lib.optionalAttrs (lib.isDerivation config.parameters.model) {
25 parameters.model = config.parameters.model.name;
27 // lib.optionalAttrs (config ? template) {
28 template = builtins.mapAttrs (n: _: templateName n) config.template;
32 [ (writers.writeYAML "${name}.yaml" config') ]
33 ++ lib.optional (lib.isDerivation config.parameters.model) config.parameters.model
34 ++ lib.optionals (config ? template) (
35 lib.mapAttrsToList (n: writeText "${templateName n}.tmpl") config.template
38 linkFarmFromDrvs name (lib.flatten (lib.mapAttrsToList genModelFiles configs));