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 +++++++++++++++++++++++++++++++++++++++++ modules/firmware/default.nix | 12 +++++------- modules/kobo/default.nix | 5 ++++- 3 files changed, 50 insertions(+), 8 deletions(-) create mode 100644 modules/device/default.nix (limited to 'modules') 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; + }; + }; + }; +} diff --git a/modules/firmware/default.nix b/modules/firmware/default.nix index 609212a..30a0779 100644 --- a/modules/firmware/default.nix +++ b/modules/firmware/default.nix @@ -4,23 +4,21 @@ let cfg = config.firmware; in { options.firmware = { - hardware = mkOption { - type = types.str; - }; date = mkOption { type = types.str; }; version = mkOption { type = types.str; }; - hash = mkOption { - type = types.str; - }; + # hash = mkOption { + # type = types.str; + # }; package = mkOption { type = types.package; default = pkgs.kobo-firmware { - inherit (cfg) hardware date version hash; + inherit (config.device) hardware; + inherit (cfg) date version; }; }; }; diff --git a/modules/kobo/default.nix b/modules/kobo/default.nix index 29ed213..47dfe91 100644 --- a/modules/kobo/default.nix +++ b/modules/kobo/default.nix @@ -44,7 +44,10 @@ in { kobo = { conf = { FeatureSettings.ExcludeSyncFolders = ''(\.(?!kobo|adobe).+|([^.][^/]*/)+\..+)''; - ApplicationPreferences.QuickTourShown = true; + ApplicationPreferences = { + SideloadedMode = true; + QuickTourShown = true; + }; }; file = mkIf (cfg.conf != {}) { -- cgit v1.2.3