blob: 3cc5281814668de3cacd8d937d864e42c9bc9e05 (
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
|
{ config, pkgs, lib, ... }:
with builtins // lib;
let
cfg = config.koreader;
in {
options.koreader = {
enable = mkEnableOption "KOReader";
package = mkPackageOption pkgs "kobo-koreader" {};
_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;
readOnly = true;
internal = true;
default = ".adds/koreader";
};
devicePath = mkOption {
type = types.str;
readOnly = true;
internal = true;
default = "/mnt/onboard/${cfg.path}";
};
file = mkOption {
default = {};
type = types.attrsOf (types.submodule (pkgs.callPackage ../lib/file-type.nix {}));
apply = filterAttrs (_: v: v.enable);
};
nickel = {
enable = mkEnableOption "Add NickelMenu entry" // { default = true; };
};
};
config = mkIf cfg.enable {
koboroot.include = [
(pkgs.linkFarm [{
name = cfg.devicePath;
path = cfg._allFiles;
})
cfg.package.KoboRoot
];
nickel.menu.item = mkIf cfg.nickel.enable {
koreader = singleton {
location = "main";
label = "KOReader";
action = "cmd_spawn";
arg = [
"quiet"
"exec ${cfg.devicePath}/koreader.sh";
];
};
};
};
}
|