check in nix

This commit is contained in:
Richard Goulter
2023-12-20 22:59:38 +07:00
parent 52f3ba680a
commit 683e7ea92e
9 changed files with 365 additions and 0 deletions

40
nix/libmcuupdate.nix Normal file
View File

@ -0,0 +1,40 @@
{ lib
, stdenv
, fetchurl
, hidapi
, libusb1
, runtimeShell
, mrs_toolchain_version ? "1.90"
, mrs_toolchain_hash ? "sha256-PO7uddJg0L2Ugv7CYLpIyRKAiE+8oXU0nG3NAdYse6g="
}:
stdenv.mkDerivation rec {
pname = "libmcuupdate";
version = mrs_toolchain_version;
src = fetchurl {
url = "http://file.mounriver.com/tools/MRS_Toolchain_Linux_x64_V${mrs_toolchain_version}.tar.xz";
hash = mrs_toolchain_hash;
};
dontConfigure = true;
dontBuild = true;
dontPatchELF = true;
dontStrip = true;
installPhase = ''
mkdir -p $out/lib
cp -r beforeinstall/libmcuupdate.so $out/lib/
'';
preFixup = ''
find $out -type f | while read f; do
patchelf "$f" > /dev/null 2>&1 || continue
patchelf --set-interpreter $(cat ${stdenv.cc}/nix-support/dynamic-linker) "$f" || true
patchelf --set-rpath ${lib.makeLibraryPath [ "$out" stdenv.cc.cc hidapi libusb1 ]} "$f" || true
done
'';
meta = {
};
}

37
nix/mrs-toolchain.nix Normal file
View File

@ -0,0 +1,37 @@
{ lib
, stdenv
, fetchurl
, runtimeShell
, mrs_toolchain_version ? "1.90"
, mrs_toolchain_hash ? "sha256-PO7uddJg0L2Ugv7CYLpIyRKAiE+8oXU0nG3NAdYse6g="
}:
stdenv.mkDerivation rec {
pname = "gcc-risc-v-embedded";
version = mrs_toolchain_version;
src = fetchurl {
url = "http://file.mounriver.com/tools/MRS_Toolchain_Linux_x64_V${mrs_toolchain_version}.tar.xz";
hash = mrs_toolchain_hash;
};
dontConfigure = true;
dontBuild = true;
dontPatchELF = true;
dontStrip = true;
installPhase = ''
mkdir -p $out/
cp -r RISC-V_Embedded_GCC/. $out
'';
preFixup = ''
find $out -type f | while read f; do
patchelf "$f" > /dev/null 2>&1 || continue
patchelf --set-interpreter $(cat ${stdenv.cc}/nix-support/dynamic-linker) "$f" || true
done
'';
meta = {
};
}

13
nix/wchisp.nix Normal file
View File

@ -0,0 +1,13 @@
{ lib, fetchFromGitHub, rustPlatform }:
rustPlatform.buildRustPackage rec {
pname = "wchisp";
version = "0.3-git";
src = fetchFromGitHub {
owner = "ch32-rs";
repo = pname;
rev = "4b4787243ef9bc87cbbb0d95c7482b4f7c9838f1";
hash = "sha256-Ju2DBv3R4O48o8Fk/AFXOBIsvGMK9hJ8Ogxk47f7gcU=";
};
cargoHash = "sha256-MbCLQBk7aJXcUOalsNbSxozvI2Tx3kerLXgi4l7BKoc=";
}

View File

@ -0,0 +1,37 @@
{ lib
, stdenv
, fetchurl
, runtimeShell
, xpack_toolchain_version ? "13.2.0-1"
, xpack_toolchain_hash ? "sha256-1+/1xdd4hzw9SG5dLIBbglgucwgfk+2zdaHvXYR2S0M="
}:
stdenv.mkDerivation rec {
pname = "gcc-risc-v-elf";
version = xpack_toolchain_version;
src = fetchurl {
url = "https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack/releases/download/v${version}/xpack-riscv-none-elf-gcc-${version}-linux-x64.tar.gz";
hash = xpack_toolchain_hash;
};
dontConfigure = true;
dontBuild = true;
dontPatchELF = true;
dontStrip = true;
installPhase = ''
mkdir -p $out/
cp -r * $out
'';
preFixup = ''
find $out -type f | while read f; do
patchelf "$f" > /dev/null 2>&1 || continue
patchelf --set-interpreter $(cat ${stdenv.cc}/nix-support/dynamic-linker) "$f" || true
done
'';
meta = {
};
}

View File

@ -0,0 +1,41 @@
{ lib
, stdenv
, fetchurl
, runtimeShell
# , xpack_toolchain_version ? "8.3.0-2.3"
# , xpack_toolchain_hash ? "sha256-cI0Mtf8S61rQcBU1lMT3dxzYbUtnIad7I/j+aVyPlAI="
# , ext ? "tar.gz"
, xpack_toolchain_version ? "8.2.0-3.1"
, xpack_toolchain_hash ? "sha256-PUD6tQ662EJP+FdI8l0uruUPhqXVIiq9ekWi5JDx5PU="
, ext ? "tgz"
}:
stdenv.mkDerivation rec {
pname = "gcc-risc-v-elf";
version = xpack_toolchain_version;
src = fetchurl {
url = "https://github.com/xpack-dev-tools/riscv-none-embed-gcc-xpack/releases/download/v${version}/xpack-riscv-none-embed-gcc-${version}-linux-x64.${ext}";
hash = xpack_toolchain_hash;
};
dontConfigure = true;
dontBuild = true;
dontPatchELF = true;
dontStrip = true;
installPhase = ''
mkdir -p $out/
cp -r riscv-none-embed-gcc/8.2.0-3.1/* $out
'';
preFixup = ''
find $out -type f | while read f; do
patchelf "$f" > /dev/null 2>&1 || continue
patchelf --set-interpreter $(cat ${stdenv.cc}/nix-support/dynamic-linker) "$f" || true
done
'';
meta = {
};
}

View File

@ -0,0 +1,38 @@
{ lib
, stdenv
, fetchurl
, runtimeShell
, xpack_toolchain_version ? "8.3.0-2.3"
, xpack_toolchain_hash ? "sha256-cI0Mtf8S61rQcBU1lMT3dxzYbUtnIad7I/j+aVyPlAI="
, ext ? "tar.gz"
}:
stdenv.mkDerivation rec {
pname = "gcc-risc-v-elf";
version = xpack_toolchain_version;
src = fetchurl {
url = "https://github.com/xpack-dev-tools/riscv-none-embed-gcc-xpack/releases/download/v${version}/xpack-riscv-none-embed-gcc-${version}-linux-x64.${ext}";
hash = xpack_toolchain_hash;
};
dontConfigure = true;
dontBuild = true;
dontPatchELF = true;
dontStrip = true;
installPhase = ''
mkdir -p $out/
cp -r * $out
'';
preFixup = ''
find $out -type f | while read f; do
patchelf "$f" > /dev/null 2>&1 || continue
patchelf --set-interpreter $(cat ${stdenv.cc}/nix-support/dynamic-linker) "$f" || true
done
'';
meta = {
};
}