summary refs log tree commit diff
path: root/pkgs/development/tools/misc/remarkable/remarkable2-toolchain/default.nix
blob: 7b4df5df16477facd0d128b2f485dad62dcf2c46 (plain) (blame)
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
{ lib, stdenv, fetchurl, libarchive, python3, file }:

stdenv.mkDerivation rec {
  pname = "remarkable2-toolchain";
  version = "2.5.2";

  src = fetchurl {
    url = "https://storage.googleapis.com/codex-public-bucket/codex-x86_64-cortexa7hf-neon-rm11x-toolchain-${version}.sh";
    sha256 = "1v410q1jn8flisdpkrymxd4pa1ylawd0rh3rljjpkqw1bp8a5vw1";
  };

  nativeBuildInputs = [
    libarchive
    python3
    file
  ];

  unpackCmd = ''
    mkdir src
    install $curSrc src/install-toolchain.sh
  '';

  dontBuild = true;

  installPhase = ''
    patchShebangs install-toolchain.sh
    sed -i -e '3,9d' install-toolchain.sh # breaks PATH
    sed -i 's|PYTHON=.*$|PYTHON=${python3}/bin/python|' install-toolchain.sh
    ./install-toolchain.sh -D -y -d $out
  '';

  meta = with lib; {
    description = "A toolchain for cross-compiling to reMarkable 2 tablets";
    homepage = "https://remarkable.engineering/";
    license = licenses.gpl2Plus;
    maintainers = with maintainers; [ tadfisher ];
    platforms = platforms.x86_64;
  };
}