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:
parent
8e6bca1b0a
commit
40b344843d
1 changed files with 15 additions and 43 deletions
|
@ -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>.#<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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue