2021-08-27 05:47:21 +03:00
|
|
|
{ config, lib, pkgs, ... }:
|
2020-04-04 21:57:23 +03:00
|
|
|
|
|
|
|
let
|
|
|
|
inherit (config) mobile;
|
2021-08-27 05:47:21 +03:00
|
|
|
inherit (lib)
|
|
|
|
mkOption
|
|
|
|
types
|
|
|
|
;
|
2020-05-24 01:13:02 +03:00
|
|
|
inherit (mobile.device) identity;
|
2020-04-04 21:57:23 +03:00
|
|
|
in
|
|
|
|
{
|
2021-08-27 05:47:21 +03:00
|
|
|
options = {
|
|
|
|
mobile.outputs.device-metadata = mkOption {
|
|
|
|
type = types.package;
|
2021-08-30 02:47:36 +03:00
|
|
|
internal = true;
|
2021-08-27 05:47:21 +03:00
|
|
|
description = ''
|
|
|
|
The device-metadata output is used internally by the documentation
|
|
|
|
generation to generate the per-device pages.
|
|
|
|
|
|
|
|
Assume this format is fluid and will change.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config.mobile.outputs.device-metadata = pkgs.writeTextFile {
|
2020-04-04 21:57:23 +03:00
|
|
|
name = "${mobile.device.name}-metadata";
|
|
|
|
destination = "/${mobile.device.name}.json";
|
|
|
|
text = (builtins.toJSON {
|
2020-05-24 01:13:02 +03:00
|
|
|
inherit (identity) name manufacturer;
|
2020-04-04 21:57:23 +03:00
|
|
|
inherit (mobile) hardware;
|
2021-01-10 03:16:24 +03:00
|
|
|
inherit (mobile) documentation;
|
2020-12-18 02:35:54 +03:00
|
|
|
quirks = {
|
|
|
|
inherit (mobile.quirks) supportsStage-0;
|
|
|
|
};
|
2020-04-04 21:57:23 +03:00
|
|
|
system = {
|
|
|
|
inherit (mobile.system) type system;
|
|
|
|
};
|
|
|
|
identifier = mobile.device.name;
|
2020-05-24 01:13:02 +03:00
|
|
|
fullName = "${identity.manufacturer} ${identity.name}";
|
2020-04-04 21:57:23 +03:00
|
|
|
});
|
|
|
|
};
|
|
|
|
}
|