blob: 2e6edf90be6ca518107e40b734ec57401010742c (
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
|
{ stdenvNoCC, fetchzip, lib, kobo-utils, gawk, ... }:
{ hardware, date, version, hash ? "", ... }:
stdenvNoCC.mkDerivation (finalAttrs: {
pname = "kobo-firmware";
inherit version hardware date;
src = fetchzip {
url = "https://ereaderfiles.kobo.com/firmwares/${finalAttrs.hardware}/${finalAttrs.date}/kobo-update-${finalAttrs.version}.zip";
stripRoot = false;
inherit hash;
};
nativeBuildInputs = [
kobo-utils
gawk
];
# outputs = [
# "out"
# "KoboRoot"
# ];
phases = [
"checkPhase"
"installPhase"
];
doCheck = true;
checkPhase = ''
KOBOVERSION="$(kobo-versionextract "$src/KoboRoot.tgz" | awk '{if ($1 == "Version:") print $2}')"
if [[ ! "$KOBOVERSION" == "${finalAttrs.version}" ]]; then
>&2 echo "Expected version ${finalAttrs.version}, but actual firmware is version $KOBOVERSION"
exit 1
fi
'';
installPhase = ''
runHook preInstall
cp -rv $src $out
# rsync -av --links --exclude="KoboRoot.tgz" $src/ $out
# mkdir $KoboRoot
# tar xvzf $src/KoboRoot.tgz --directory=$KoboRoot
runHook postInstall
'';
passthru = {
inherit hardware date;
};
meta = with lib; {
homepage = "https://pgaskin.net/KoboStuff/kobofirmware.html";
description = ''
Kobo firmware files.
'';
platform = platforms.all;
# outputsToInstall = finalAttrs.outputs;
};
})
|