From 373d5246eb53ef1a13166b066248526f33f935db Mon Sep 17 00:00:00 2001 From: Chris Wells Date: Thu, 5 Sep 2024 19:45:28 -0500 Subject: Trying to get the kobo api working for querying firmware --- modules/device/default.nix | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 modules/device/default.nix (limited to 'modules/device/default.nix') diff --git a/modules/device/default.nix b/modules/device/default.nix new file mode 100644 index 0000000..22cf180 --- /dev/null +++ b/modules/device/default.nix @@ -0,0 +1,41 @@ +{ config, pkgs, lib, ... }: +with builtins // lib; +let + devices = import ../../data/devices.nix; + + hardware = mkOption { + type = types.strMatching ''^kobo\d+$''; + }; + deviceID = mkOption { + type = types.strMatching ''00000000-0000-0000-0000-000000000\d\d\d''; + }; + + deviceInfo = types.submodule { + options = { + inherit hardware deviceID; + }; + }; +in { + options = { + _allDevices = mkOption { + default = devices; + readOnly = true; + internal = true; + type = types.attrsOf deviceInfo; + }; + + device = { + name = mkOption { + type = types.enum (attrNames devices); + }; + + hardware = hardware // { + default = config._allDevices.${config.device.name}.hardware; + }; + + deviceID = deviceID // { + default = config._allDevices.${config.device.name}.deviceID; + }; + }; + }; +} -- cgit v1.2.3