aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorChris Wells <chris@mathematicaster.org>2024-09-11 10:50:30 -0500
committerChris Wells <chris@mathematicaster.org>2024-09-11 10:50:30 -0500
commitc3052ddc4e54092bfc9220d550ab4d8fcba166de (patch)
tree836e2f11242afe8911e9eabd644c9a20ab668f3d /modules
parent4f471484b3a1e16230979a8406503a220b9101f4 (diff)
downloadkobo-manager-c3052ddc4e54092bfc9220d550ab4d8fcba166de.tar
kobo-manager-c3052ddc4e54092bfc9220d550ab4d8fcba166de.tar.gz
kobo-manager-c3052ddc4e54092bfc9220d550ab4d8fcba166de.tar.bz2
kobo-manager-c3052ddc4e54092bfc9220d550ab4d8fcba166de.tar.lz
kobo-manager-c3052ddc4e54092bfc9220d550ab4d8fcba166de.tar.xz
kobo-manager-c3052ddc4e54092bfc9220d550ab4d8fcba166de.tar.zst
kobo-manager-c3052ddc4e54092bfc9220d550ab4d8fcba166de.zip
The modules seem fairly solid now. Now to write the cli
Diffstat (limited to 'modules')
-rw-r--r--modules/build/firmware.nix3
-rw-r--r--modules/default.nix1
-rw-r--r--modules/device/default.nix18
-rw-r--r--modules/kfmon/default.nix34
-rw-r--r--modules/kobo/default.nix16
-rw-r--r--modules/koreader/default.nix23
-rw-r--r--modules/nickel/default.nix8
-rw-r--r--modules/onboard/default.nix49
-rw-r--r--modules/plato/default.nix43
9 files changed, 140 insertions, 55 deletions
diff --git a/modules/build/firmware.nix b/modules/build/firmware.nix
index 3a1039b..785de4f 100644
--- a/modules/build/firmware.nix
+++ b/modules/build/firmware.nix
@@ -32,8 +32,7 @@ in {
];
} ''
mkdir $out
- tar czvf $out/KoboRoot.tgz --directory="${config.firmware.package.KoboRoot}" . --mode=u+w
- rsync -rv --links --executability --chmod=u+w "${config.firmware.package.out}/" $out
+ rsync -rv --links --executability --chmod=u+w "${config.firmware.package}/" $out
# Check that we haven't fucked up!
KOBOVERSION="$(kobo-versionextract "$out/KoboRoot.tgz" | awk '{if ($1 == "Version:") print $2}')"
diff --git a/modules/default.nix b/modules/default.nix
index 1c9fee4..3cf1fe6 100644
--- a/modules/default.nix
+++ b/modules/default.nix
@@ -8,6 +8,7 @@
./koboroot
./koreader
./nickel
+ ./onboard
./plato
];
}
diff --git a/modules/device/default.nix b/modules/device/default.nix
index 23be585..114c68c 100644
--- a/modules/device/default.nix
+++ b/modules/device/default.nix
@@ -34,6 +34,14 @@ in {
default = "kobo";
};
+ forceAffiliate = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Write the given affiliate to /mnt/onboard/.kobo/affiliate.conf
+ '';
+ };
+
hardware = hardware // {
default = config._allDevices.${config.device.name}.hardware;
};
@@ -48,4 +56,14 @@ in {
};
};
};
+
+ config = {
+ onboard.file = {
+ ".kobo/affiliate.conf" = mkIf config.device.forceAffiliate {
+ text = generators.toINI {} {
+ General.affiliate = config.device.affiliate;
+ };
+ };
+ };
+ };
}
diff --git a/modules/kfmon/default.nix b/modules/kfmon/default.nix
index a2fcbb9..8ac50e4 100644
--- a/modules/kfmon/default.nix
+++ b/modules/kfmon/default.nix
@@ -83,23 +83,37 @@ in {
kfmon.file = mapAttrs' (n: v: {
name = "kfmon-config-${n}";
value = {
- text = generators.toINI {} v;
+ text = generators.toINI {
+ mkKeyValue = generators.mkKeyValueDefault {} " = ";
+ } v;
target =
let
- fixedN = if isSuffix ".ini" n then n else "${n}.ini";
+ fixedN = if hasSuffix ".ini" n then n else "${n}.ini";
in "config/${fixedN}";
};
- });
+ }) cfg.configs;
+
+ kfmon.configs = {
+ kfmon.daemon = {
+ db_timeout = 500;
+ use_syslog = 0;
+ with_notifications = 1;
+ };
+ kfmon-log.watch = {
+ filename = "/mnt/onboard/icons/kfmon.png";
+ action = "${cfg.devicePath}/bin/kfmon-printlog.sh";
+ label = "Show KFMon log";
+ hidden = 1;
+ block_spawns = 0;
+ do_db_update = 0;
+ db_title = "KFMon Log";
+ db_author = "NiLuJe";
+ db_comment = "Print the last few lines of KFMon's log";
+ };
+ };
}
(mkIf cfg.enable {
koboroot.include = singleton cfg.finalPackage;
- # koboroot.include = [
- # (pkgs.linkFarm [{
- # name = cfg.devicePath;
- # path = cfg._allFiles;
- # }])
- # cfg.package.KoboRoot
- # ];
})
];
}
diff --git a/modules/kobo/default.nix b/modules/kobo/default.nix
index 48bca11..ec0c469 100644
--- a/modules/kobo/default.nix
+++ b/modules/kobo/default.nix
@@ -65,23 +65,37 @@ in {
default = {};
description = "https://wiki.mobileread.com/wiki/Kobo_Configuration_Options";
};
+
+ analytics = mkOption {
+ type = ini.type;
+ default = {};
+ };
};
config = mkMerge [
{
kobo = {
conf = {
- FeatureSettings.ExcludeSyncFolders = ''(\.(?!kobo|adobe).+|([^.][^/]*/)+\..+)'';
ApplicationPreferences = {
+ CurrentLocale = "en";
SideloadedMode = true;
QuickTourShown = true;
};
+ FeatureSettings = {
+ ExcludeSyncFolders = ''(\\.(?!kobo|adobe).+|([^.][^/]*/)+\\..+)'';
+ };
+ DialogSettings = {
+ ReleaseNotesShown = true;
+ };
};
file = {
"Kobo eReader.conf" = mkIf (cfg.conf != {}) {
text = generators.toINI {} cfg.conf;
};
+ "Analytics.conf" = mkIf (cfg.analytics != {}) {
+ text = generators.toINI {} cfg.analytics;
+ };
};
};
}
diff --git a/modules/koreader/default.nix b/modules/koreader/default.nix
index ab1be83..41355b7 100644
--- a/modules/koreader/default.nix
+++ b/modules/koreader/default.nix
@@ -35,15 +35,6 @@ in {
];
};
};
- # _allFiles = mkOption {
- # type = types.package;
- # readOnly = true;
- # internal = true;
- # default = pkgs.symlinkJoin {
- # name = "koreader-files";
- # paths = mapAttrsToList (_: v: v._package) cfg.file ++ [ cfg.package ];
- # };
- # };
path = mkOption {
type = types.str;
@@ -66,7 +57,7 @@ in {
};
nickel = {
- enable = mkEnableOption "Add NickelMenu entry" // { default = true; };
+ enable = mkEnableOption "Add NickelMenu entry" // { default = ! config.kfmon.enable; };
};
};
@@ -88,6 +79,18 @@ in {
];
};
};
+
+ kfmon.configs.koreader.watch = {
+ filename = "/mnt/onboard/icons/koreader.png";
+ action = "${cfg.devicePath}/koreader.sh";
+ label = "KOReader";
+ hidden = 0;
+ block_spawns = 1;
+ do_db_update = 0;
+ db_title = "KOReader";
+ db_author = "KOReader Devs";
+ db_comment = "An eBook reader application";
+ };
})
];
}
diff --git a/modules/nickel/default.nix b/modules/nickel/default.nix
index 7663e93..d9c208a 100644
--- a/modules/nickel/default.nix
+++ b/modules/nickel/default.nix
@@ -159,19 +159,19 @@ in {
info.nickel = cfg.enable;
nickel = {
- file = mkMerge [
+ file =
(mapAttrs (_: v: {
text = concatMapStringsSep "\n" createGenerator v;
}) cfg.menu.generator)
-
+ //
(mapAttrs (_: v: {
text = concatStringsSep "\n" (mapAttrsToList createExperimental v);
}) cfg.menu.experimental)
-
+ //
(mapAttrs (_: v: {
text = concatMapStringsSep "\n" createMenuItem v;
}) cfg.menu.item)
- ];
+ ;
};
}
(mkIf cfg.enable {
diff --git a/modules/onboard/default.nix b/modules/onboard/default.nix
new file mode 100644
index 0000000..4af7573
--- /dev/null
+++ b/modules/onboard/default.nix
@@ -0,0 +1,49 @@
+{ config, pkgs, lib, ... }:
+with builtins // lib;
+let
+ cfg = config.onboard;
+in {
+ options.onboard = {
+
+ file = mkOption {
+ default = {};
+ type = types.attrsOf (types.submodule (pkgs.callPackage ../lib/file-type.nix {}));
+ apply = filterAttrs (_: v: v.enable);
+ };
+
+ devicePath = mkOption {
+ type = types.str;
+ readOnly = true;
+ internal = true;
+ default = "/mnt/onboard";
+ };
+
+ _createdFiles = mkOption {
+ type = types.package;
+ internal = true;
+ readOnly = true;
+ default = pkgs.buildEnv {
+ name = "onboard-files-created";
+ paths = mapAttrsToList (_: v: v._package) cfg.file;
+ extraPrefix = cfg.devicePath;
+ };
+ };
+
+ finalPackage = mkOption {
+ type = types.package;
+ readOnly = true;
+ internal = true;
+ default = pkgs.mergePaths {
+ name = "onboard-package";
+ paths = [
+ cfg._createdFiles
+ ];
+ };
+ };
+ };
+
+ config = {
+ koboroot.include = mkAfter [ cfg.finalPackage ];
+ };
+
+}
diff --git a/modules/plato/default.nix b/modules/plato/default.nix
index 74fe8c1..8312912 100644
--- a/modules/plato/default.nix
+++ b/modules/plato/default.nix
@@ -70,31 +70,6 @@ in {
cfg.package.KoboRoot
];
};
- # pkgs.symlinkJoin {
- # name = "plato-package";
- # paths = [
- # cfg._createdFiles
- # # (pkgs.linkFarm "plato-files" [{
- # # name = removePrefix "/" cfg.devicePath;
- # # path = cfg.package.out;
- # # }])
- # (pkgs.runCommandLocal "plato-files" {} ''
- # mkdir -p "$(dirname "$out${cfg.devicePath}")"
- # cp -r "${cfg.package.out}" "$out${cfg.devicePath}"
- # '')
- # cfg.package.KoboRoot
- # ];
- # };
- };
-
- _allFiles = mkOption {
- type = types.package;
- readOnly = true;
- internal = true;
- default = pkgs.symlinkJoin {
- name = "plato-files";
- paths = mapAttrsToList (_: v: v._package) cfg.file ++ [ cfg.package ];
- };
};
file = mkOption {
@@ -104,7 +79,7 @@ in {
};
nickel = {
- enable = mkEnableOption "Add NickelMenu option" // { default = true; };
+ enable = mkEnableOption "Add NickelMenu option" // { default = ! config.kfmon.enable; };
};
@@ -153,7 +128,7 @@ in {
default =
let
copyDicts = pkg: ''
- find ${pkg}/share/dictd/ -type f -regex '.*\.\(dict\(\.dz\)?\|index\)' -exec cp -v {} $out/ \;
+ find ${pkg}/ -type f -regex '^.*\.\(dict\(\.dz\)?\|index\)$' -exec cp -v {} $out/ \;
'';
in pkgs.runCommandLocal "plato-dictionaries" {} ''
mkdir $out
@@ -173,7 +148,7 @@ in {
default =
let
copyFonts = pkg: ''
- find ${pkg}/share/fonts/ -type f -regex '.*\.\(ttf\|otf\)' -exec cp -v {} $out/ \;
+ find ${pkg}/ -type f -regex '^.*\.\(ttf\|otf\)$' -exec cp -v {} $out/ \;
'';
in pkgs.runCommandLocal "plato-fonts" {} ''
mkdir $out
@@ -231,6 +206,18 @@ in {
];
};
};
+
+ kfmon.configs.plato.watch = {
+ filename = "/mnt/onboard/icons/plato.png";
+ action = "${cfg.devicePath}/plato.sh";
+ label = "Plato";
+ hidden = 0;
+ block_spawns = 1;
+ do_db_update = 0;
+ db_title = "Plato";
+ db_author = "Baskerville";
+ db_comment = "A document reader";
+ };
})
];
}