{ config, pkgs, lib, options, ... }: with builtins // lib; let cfg = config.kobo; ini = pkgs.formats.ini {}; importOption = p: (import p { inherit pkgs lib; } cfg.path).option; in { options.kobo = { enable = mkEnableOption "main configurations"; path = mkOption { type = types.str; default = ".kobo/Kobo"; description = "Relative path to main Kobo config"; }; devPath = mkOption { type = types.str; default = "/mnt/onboard/${cfg.path}" readOnly = true; internal = true; }; file = importOption ./lib/file.nix; manifest = importOption ./lib/manifest.nix; config = mkOption { type = ini.type; default = {}; description = "https://wiki.mobileread.com/wiki/Kobo_Configuration_Options"; }; }; config = { # file = mapAttrs' (n: v: { # name = "kobo-${n}"; # value = v // { # target = "${cfg.path}/${v.target}"; # }; # }) cfg.file; # manifest = mapAttrs' (n: v: { # name = "kobo-${n}"; # value = v // { # targets = map (x: "${cfg.path}/${x}") v.targets; # }; # }) cfg.manifest; kobo = { config = { FeatureSettings = { ExcludeSyncFolders = ''(\.(?!kobo|adobe).+|([^.][^/]*/)+\..+)''; }; ApplicationPreferences = { QuickTourShown = true; }; }; file = mkMerge [ (mkIf (cfg.config != {}) { "Kobo eReader.conf".text = generators.toINI {} cfg.config; }) ]; manifest = { "Kobo eReader.conf".mergeTool = local: remote: '' ${getBin pkgs.crudini}/bin/crudini --merge "${remote}" < "${local}" ''; }; }; }; }