1
0
Fork 0
mirror of https://github.com/hercules-ci/flake-parts.git synced 2024-12-14 11:47:31 +00:00

apps: Use mkTransposedPerSystemModule

This commit is contained in:
Shea Levy 2022-10-30 06:53:32 -04:00
parent 8e6bca1b0a
commit 40b344843d
No known key found for this signature in database
GPG key ID: 5C0BD6957D86FE27

View file

@ -1,15 +1,11 @@
{ config, lib, flake-parts-lib, ... }:
let
inherit (lib)
filterAttrs
mapAttrs
mkOption
optionalAttrs
types
;
inherit (flake-parts-lib)
mkSubmoduleOptions
mkPerSystemOption
mkTransposedPerSystemModule
;
programType = lib.types.coercedTo derivationType getExe lib.types.str;
@ -44,27 +40,9 @@ let
};
};
in
{
options = {
flake = mkSubmoduleOptions {
apps = mkOption {
type = types.lazyAttrsOf (types.lazyAttrsOf appType);
default = { };
description = ''
Programs runnable with nix run <literal>.#&lt;name></literal>.
'';
example = lib.literalExpression or lib.literalExample ''
{
x86_64-linux.default.program = "''${config.packages.hello}/bin/hello";
}
'';
};
};
perSystem = mkPerSystemOption
({ config, system, ... }: {
options = {
apps = mkOption {
mkTransposedPerSystemModule {
name = "apps";
option = mkOption {
type = types.lazyAttrsOf appType;
default = { };
description = ''
@ -76,11 +54,5 @@ in
}
'';
};
};
});
};
config = {
transposition.apps = { };
};
file = ./apps.nix;
}