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, ... }:
|
{ config, lib, flake-parts-lib, ... }:
|
||||||
let
|
let
|
||||||
inherit (lib)
|
inherit (lib)
|
||||||
filterAttrs
|
|
||||||
mapAttrs
|
|
||||||
mkOption
|
mkOption
|
||||||
optionalAttrs
|
|
||||||
types
|
types
|
||||||
;
|
;
|
||||||
inherit (flake-parts-lib)
|
inherit (flake-parts-lib)
|
||||||
mkSubmoduleOptions
|
mkTransposedPerSystemModule
|
||||||
mkPerSystemOption
|
|
||||||
;
|
;
|
||||||
|
|
||||||
programType = lib.types.coercedTo derivationType getExe lib.types.str;
|
programType = lib.types.coercedTo derivationType getExe lib.types.str;
|
||||||
|
@ -44,27 +40,9 @@ let
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
{
|
mkTransposedPerSystemModule {
|
||||||
options = {
|
name = "apps";
|
||||||
flake = mkSubmoduleOptions {
|
option = mkOption {
|
||||||
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 {
|
|
||||||
type = types.lazyAttrsOf appType;
|
type = types.lazyAttrsOf appType;
|
||||||
default = { };
|
default = { };
|
||||||
description = ''
|
description = ''
|
||||||
|
@ -76,11 +54,5 @@ in
|
||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
file = ./apps.nix;
|
||||||
});
|
|
||||||
|
|
||||||
};
|
|
||||||
config = {
|
|
||||||
transposition.apps = { };
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue