1
1
mirror of https://github.com/NixOS/mobile-nixos.git synced 2024-12-15 02:43:24 +03:00
mobile-nixos/modules/devices-metadata.nix

42 lines
1.0 KiB
Nix
Raw Normal View History

{ config, lib, pkgs, ... }:
let
inherit (config) mobile;
inherit (lib)
mkOption
types
;
2020-05-24 01:13:02 +03:00
inherit (mobile.device) identity;
in
{
options = {
mobile.outputs.device-metadata = mkOption {
type = types.package;
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 {
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;
inherit (mobile) hardware;
inherit (mobile) documentation;
quirks = {
inherit (mobile.quirks) supportsStage-0;
};
system = {
inherit (mobile.system) type system;
};
identifier = mobile.device.name;
2020-05-24 01:13:02 +03:00
fullName = "${identity.manufacturer} ${identity.name}";
});
};
}