blob: 95ef664a880a439531cef479550465eddd0ea454 (
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
|
{ config, pkgs, lib, ... }:
with builtins // lib;
let
json = pkgs.formats.json {};
cfg = config.build.info;
in {
options = {
info = mkOption {
internal = true;
type = json.type;
default = {};
};
build = {
info = mkOption {
internal = true;
readOnly = true;
type = types.package;
default = pkgs.writeShellApplication {
name = "kobo-info";
runtimeInputs = with pkgs; [
jq
kobo-utils
];
text = ''
echo "Local information:"
echo '${toJSON config.info}' | jq .
echo "Remote information:"
KOBOPATH="$(kobo-find -f || echo "")"
if [[ -z "$KOBOPATH" ]]; then
echo "No remote found"
exit 0
fi
kobo-info --json "$KOBOPATH" | jq .
'';
};
};
};
};
config = {
info = {
device = {
inherit (config.device) name affiliate hardware deviceID serialNumber;
};
firmware = {
inherit (config.firmware) version date;
};
};
};
}
|