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:
parent
9179158645
commit
75a0d1a7db
30
modules/devices-metadata.nix
Normal file
30
modules/devices-metadata.nix
Normal 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;
|
||||
});
|
||||
};
|
||||
}
|
@ -9,6 +9,7 @@
|
||||
./adb.nix
|
||||
./boot-initrd.nix
|
||||
./cross-workarounds.nix
|
||||
./devices-metadata.nix
|
||||
./hardware-allwinner.nix
|
||||
./hardware-generic.nix
|
||||
./hardware-qualcomm.nix
|
||||
|
Loading…
Reference in New Issue
Block a user