aboutsummaryrefslogtreecommitdiff
path: root/modules/kobo.nix
diff options
context:
space:
mode:
authorChris Wells <chris@mathematicaster.org>2024-01-25 11:26:31 -0600
committerChris Wells <chris@mathematicaster.org>2024-01-25 11:26:31 -0600
commit45156e2bdb359c22398f8c7a60fb729ad168786a (patch)
treee8e8ca1e9a1b4505df1187028091f9cf2b173ef9 /modules/kobo.nix
parentd6949fe35c1b4c7a9e93d1430e5c1b1d5dd4d9c6 (diff)
downloadkobo-manager-45156e2bdb359c22398f8c7a60fb729ad168786a.tar
kobo-manager-45156e2bdb359c22398f8c7a60fb729ad168786a.tar.gz
kobo-manager-45156e2bdb359c22398f8c7a60fb729ad168786a.tar.bz2
kobo-manager-45156e2bdb359c22398f8c7a60fb729ad168786a.tar.lz
kobo-manager-45156e2bdb359c22398f8c7a60fb729ad168786a.tar.xz
kobo-manager-45156e2bdb359c22398f8c7a60fb729ad168786a.tar.zst
kobo-manager-45156e2bdb359c22398f8c7a60fb729ad168786a.zip
This distribution is coming together
Diffstat (limited to 'modules/kobo.nix')
-rw-r--r--modules/kobo.nix116
1 files changed, 70 insertions, 46 deletions
diff --git a/modules/kobo.nix b/modules/kobo.nix
index d46da7e..21f7995 100644
--- a/modules/kobo.nix
+++ b/modules/kobo.nix
@@ -1,61 +1,85 @@
-{ config, pkgs, lib, ... }:
+{ config, pkgs, lib, options, ... }:
with builtins // lib;
let
cfg = config.kobo;
+ ini = pkgs.formats.ini {};
in {
- imports = [
- ./kfmon.nix
- ./koreader.nix
- ./plato.nix
- ];
-
options.kobo = {
- package = mkOption {
- type = types.package;
- description = "The resulting kobo configuration";
- default = if cfg.generate == "" then cfg.src else pkgs.stdenvNoCC.mkDerivation {
- inherit (cfg) src;
- name = "kobo-config";
-
- dontBuild = true;
- dontFixup = true;
- dontConfigure = true;
- dontPatch = true;
-
- installPhase = ''
- mkdir -p $out
- cp -rv . $out
-
- ${cfg.generate}
- '';
- };
+ enable = mkEnableOption "main configurations";
+
+ path = mkOption {
+ type = types.str;
+ default = ".kobo/Kobo";
+ description = "Relative path to main Kobo config";
+ };
+
+ file = mkOption {
+ type = options.file.type;
+ default = {};
+ description = "Files relative to ${cfg.path}";
};
- src = mkOption {
- type = types.package;
- description = "The base source files to use";
- default = with pkgs.kobo.src;
- if config.plato.enable && config.koreader.enable then KOReader-Plato
- else if config.plato.enable then Plato
- else if config.koreader.enable then KOReader
- else if config.kfmon.enable then KFMon
- else error "At least one of plato, koreader or kfmon must be enabled in order to use a default package";
+ manifest = mkOption {
+ type = options.manifest.type;
+ default = {};
+ description = "Manifest relative to ${cfg.path}";
};
- generate = mkOption {
- type = types.lines;
- default = "";
- description = "Script used to generate the kobo config";
+ config = mkOption {
+ type = ini.type;
+ default = {};
+ description = "https://wiki.mobileread.com/wiki/Kobo_Configuration_Options";
};
+
+ # src = mkOption {
+ # type = types.package;
+ # description = "The base source files to use";
+ # default = with pkgs.kobo.src;
+ # if config.plato.enable && config.koreader.enable then KOReader-Plato
+ # else if config.plato.enable then Plato
+ # else if config.koreader.enable then KOReader
+ # else if config.kfmon.enable then KFMon
+ # else error "At least one of plato, koreader or kfmon must be enabled in order to use a default package";
+ # };
+
};
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 = {
- generate = mkBefore (concatStringsSep "\n" (
- optional config.kfmon.enable config.kfmon.generate ++
- optional config.plato.enable config.plato.generate ++
- optional config.koreader.enable config.koreader.generate
- ));
+ 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}" > "${remote}"
+ '';
+ };
};
- };
-}
+
+
+ }