1
0
Fork 0
mirror of https://github.com/hercules-ci/flake-parts.git synced 2025-03-15 13:07:52 +00:00
flake-parts/modules/apps.nix

52 lines
1.1 KiB
Nix
Raw Normal View History

2023-05-29 13:52:03 -04:00
{ lib, flake-parts-lib, ... }:
2022-05-11 22:45:26 +02:00
let
inherit (lib)
mkOption
types
getExe
2022-05-11 22:45:26 +02:00
;
2022-05-25 16:36:33 +02:00
inherit (flake-parts-lib)
2022-10-30 06:53:32 -04:00
mkTransposedPerSystemModule
2022-05-11 22:45:26 +02:00
;
programType = lib.types.coercedTo derivationType getExe lib.types.str;
derivationType = lib.types.package // {
check = lib.isDerivation;
};
2022-05-11 22:45:26 +02:00
appType = lib.types.submodule {
options = {
type = mkOption {
2022-05-17 09:55:23 +02:00
type = lib.types.enum [ "app" ];
2022-05-11 22:45:26 +02:00
default = "app";
2022-11-11 07:39:25 +01:00
description = ''
2022-11-11 06:40:37 +01:00
A type tag for `apps` consumers.
2022-05-11 22:45:26 +02:00
'';
};
program = mkOption {
type = programType;
2022-11-11 07:39:25 +01:00
description = ''
2022-11-11 06:40:37 +01:00
A path to an executable or a derivation with `meta.mainProgram`.
2022-05-11 22:45:26 +02:00
'';
};
};
};
in
2022-10-30 06:53:32 -04:00
mkTransposedPerSystemModule {
name = "apps";
option = mkOption {
type = types.lazyAttrsOf appType;
default = { };
description = ''
2022-11-11 06:40:37 +01:00
Programs runnable with nix run `<name>`.
2022-10-30 06:53:32 -04:00
'';
example = lib.literalExpression or lib.literalExample ''
{
default.program = "''${config.packages.hello}/bin/hello";
}
'';
2022-05-11 22:45:26 +02:00
};
2022-10-30 06:53:32 -04:00
file = ./apps.nix;
2022-05-11 22:45:26 +02:00
}