blob: 673c3795ef920e5220c8d5de0d3eb578c0d93c0e (
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
|
{ config, pkgs, lib, ... }:
with builtins // lib;
let
cfg = config.build;
in {
options.build = {
firmware = {
checkDevice = mkOption {
internal = true;
readOnly = true;
type = types.package;
default = pkgs.writeShellApplication {
name = "check-firmware";
runtimeInputs = with pkgs; [
kobo-utils
];
text = ''
echo "hi"
'';
};
};
bundle =
let
b = pkgs.runCommandLocal "package-firmware" {} ''
cp -r "${config.firmware.package.out}" $out
tar czvf $out/KoboRoot.tgz --directory="${config.firmware.package.KoboRoot}"
'';
in pkgs.runCommandLocal "bundle-firmware" {} ''
tar czvf $out --directory "${b}"
'';
deploy = pkgs.writeShellApplication {
name = "deploy-firmware";
runtimeInputs = with pkgs; [
gnutar
kobo-utils
];
text = ''
echo "Looking for kobo"
KOBOPATH="$(kobo-find -f -w)"
if [ -z "$KOBOPATH" ]; then
>&2 echo "Cannot locate kobo device"
exit 1
fi
echo "Found kobo device at $KOBOPATH"
echo "Placing firmware on device"
tar xzvf "${cfg.fimware.bundle}" --directory="$KOBOPATH/.kobo/"
echo "Successfully installed kobo firmware. Please eject your device so it can install."
'';
};
};
};
}
|