modular-flake/nix/output/apps.nix

38 lines
973 B
Nix

{ lib, ... }:
with lib;
{
config.outputKinds = [
(
{ hasSystem, ... }:
optionalAttrs hasSystem {
options = {
apps = mkOption {
type =
with types;
attrsOf (submodule {
options = {
type = mkOption {
type = enum [ "app" ];
default = "app";
};
program = mkOption {
type = path;
description = "An executable to run";
};
meta = mkOption {
type = attrs;
description = "App metadata";
default = { };
};
};
});
description = "Executed by `nix run .#<name>`";
};
};
outputs = { config, system, ... }: {
apps.${system} = config.apps;
};
}
)
];
}