blob: ec0c4692f056df3064fe19259259c1cffd41cfb3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
{ config, pkgs, lib, ... }:
with builtins // lib;
let
cfg = config.kobo;
ini = pkgs.formats.ini {};
in {
options.kobo = {
enable = mkEnableOption "main configurations";
path = mkOption {
type = types.str;
readOnly = true;
internal = true;
default = ".kobo/Kobo";
};
devicePath = mkOption {
type = types.str;
readOnly = true;
internal = true;
default = "/mnt/onboard/${cfg.path}";
};
_createdFiles = mkOption {
type = types.package;
internal = true;
readOnly = true;
default = pkgs.buildEnv {
name = "kobo-files-created";
paths = mapAttrsToList (_: v: v._package) cfg.file;
extraPrefix = cfg.devicePath;
};
};
finalPackage = mkOption {
type = types.package;
internal = true;
readOnly = true;
default = pkgs.mergePaths {
name = "kobo-package";
paths = [
cfg._createdFiles
];
};
};
file = mkOption {
default = {};
type = types.attrsOf (types.submodule (pkgs.callPackage ../lib/file-type.nix {}));
apply = filterAttrs (_: v: v.enable);
};
# _allFiles = mkOption {
# type = types.package;
# readOnly = true;
# internal = true;
# default = pkgs.symlinkJoin {
# name = "kobo-files";
# paths = mapAttrsToList (v: v._package) cfg.file;
# };
# };
conf = mkOption {
type = ini.type;
default = {};
description = "https://wiki.mobileread.com/wiki/Kobo_Configuration_Options";
};
analytics = mkOption {
type = ini.type;
default = {};
};
};
config = mkMerge [
{
kobo = {
conf = {
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;
};
};
};
}
(mkIf cfg.enable {
koboroot.include = singleton cfg.finalPackage;
})
];
}
|