1
1
mirror of https://github.com/NixOS/mobile-nixos.git synced 2024-12-14 18:21:41 +03:00

devices-metadata: Generate metadata using the modules system

This commit is contained in:
Samuel Dionne-Riel 2020-04-04 14:57:23 -04:00
parent 9179158645
commit 75a0d1a7db
2 changed files with 31 additions and 0 deletions

View File

@ -0,0 +1,30 @@
{ config, pkgs, ... }:
let
inherit (config) mobile;
inherit (mobile.device) info;
in
{
# 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.
system.build.device-metadata = pkgs.writeTextFile {
name = "${mobile.device.name}-metadata";
destination = "/${mobile.device.name}.json";
text = (builtins.toJSON {
inherit (info) name;
inherit (mobile) hardware;
system = {
inherit (mobile.system) type system;
};
manufacturer = if info ? manufacturer then info.manufacturer else "N/A";
identifier = mobile.device.name;
fullName = if info ? manufacturer
then "${info.manufacturer} ${info.name}"
else info.name;
});
};
}

View File

@ -9,6 +9,7 @@
./adb.nix
./boot-initrd.nix
./cross-workarounds.nix
./devices-metadata.nix
./hardware-allwinner.nix
./hardware-generic.nix
./hardware-qualcomm.nix