modular-flake/nix/output/templates.nix

33 lines
809 B
Nix

{ lib, ... }:
with lib;
{
config.outputKinds = [
(
{ hasSystem, ... }:
optionalAttrs (!hasSystem) {
options = {
templates = mkOption {
type =
with types;
attrsOf (submodule {
options = {
path = mkOption {
type = path;
description = "Path to the template directory";
};
description = mkOption {
type = str;
default = "";
};
};
});
description = "Used by `nix flake init -t <flake>#<name>`";
};
};
outputs = { config, ... }: {
templates = config.templates;
};
}
)
];
}