aboutsummaryrefslogtreecommitdiff
path: root/pkgs/firmware/default.nix
blob: 932ecf1b47bdd7fd8b7c86ca5dcdfe2436a8a24c (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
{ stdenvNoCC, fetchzip, lib, ... }:
{ 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";
    inherit hash;
  };

  outputs = [
    "out"
    "KoboRoot"
  ];

  phases = "installPhase";

  installPhase = ''
    runHook preInstall

    mkdir $out
    cp -r $src/{manifest.md5sum,upgrade} $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;
  };
})