check in nix
This commit is contained in:
parent
52f3ba680a
commit
683e7ea92e
61
flake.lock
generated
Normal file
61
flake.lock
generated
Normal file
@ -0,0 +1,61 @@
|
||||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1701680307,
|
||||
"narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "4022d587cbbfd70fe950c1e2083a02621806a725",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1703105089,
|
||||
"narHash": "sha256-1F7hDLj58OQCADRtG2DRKpmJ8QVza0M0NK/kfLWLs3k=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "2b9c57d33e3d5be6262e124fc66e3a8bc650b93d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
26
flake.nix
Normal file
26
flake.nix
Normal file
@ -0,0 +1,26 @@
|
||||
{
|
||||
description = "The CH592 HID_Keyboard EVT Example";
|
||||
|
||||
inputs = {
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||
};
|
||||
|
||||
outputs = {
|
||||
self,
|
||||
nixpkgs,
|
||||
flake-utils,
|
||||
}:
|
||||
flake-utils.lib.eachSystem [
|
||||
flake-utils.lib.system.x86_64-linux
|
||||
] (system: let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
in {
|
||||
devShells = {
|
||||
default = import ./shell.nix {
|
||||
inherit pkgs;
|
||||
};
|
||||
};
|
||||
});
|
||||
}
|
40
nix/libmcuupdate.nix
Normal file
40
nix/libmcuupdate.nix
Normal 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
37
nix/mrs-toolchain.nix
Normal 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
13
nix/wchisp.nix
Normal 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=";
|
||||
}
|
37
nix/xpack-riscv-none-elf-gcc.nix
Normal file
37
nix/xpack-riscv-none-elf-gcc.nix
Normal 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 = {
|
||||
};
|
||||
}
|
41
nix/xpack-riscv-none-embed-gcc-8.2.nix
Normal file
41
nix/xpack-riscv-none-embed-gcc-8.2.nix
Normal 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 = {
|
||||
};
|
||||
}
|
38
nix/xpack-riscv-none-embed-gcc.nix
Normal file
38
nix/xpack-riscv-none-embed-gcc.nix
Normal 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 = {
|
||||
};
|
||||
}
|
72
shell.nix
Normal file
72
shell.nix
Normal file
@ -0,0 +1,72 @@
|
||||
{ pkgs ? import <nixpkgs> {}
|
||||
, mrs_toolchain_version ? "1.90"
|
||||
, mrs_toolchain_hash ? "sha256-PO7uddJg0L2Ugv7CYLpIyRKAiE+8oXU0nG3NAdYse6g="
|
||||
}:
|
||||
|
||||
let
|
||||
libmcuupdate = pkgs.callPackage ./nix/libmcuupdate.nix {
|
||||
inherit
|
||||
mrs_toolchain_version
|
||||
mrs_toolchain_hash;
|
||||
};
|
||||
mrs-toolchain = pkgs.callPackage ./nix/mrs-toolchain.nix {
|
||||
inherit
|
||||
mrs_toolchain_version
|
||||
mrs_toolchain_hash;
|
||||
};
|
||||
xpack-riscv-none-embed-gcc-8_2 = pkgs.callPackage ./nix/xpack-riscv-none-embed-gcc-8.2.nix {
|
||||
xpack_toolchain_version = "8.2.0-3.1";
|
||||
xpack_toolchain_hash = "sha256-PUD6tQ662EJP+FdI8l0uruUPhqXVIiq9ekWi5JDx5PU=";
|
||||
ext = "tgz";
|
||||
};
|
||||
xpack-riscv-none-embed-gcc-8_3 = pkgs.callPackage ./nix/xpack-riscv-none-embed-gcc.nix {
|
||||
xpack_toolchain_version = "8.3.0-2.3";
|
||||
xpack_toolchain_hash = "sha256-cI0Mtf8S61rQcBU1lMT3dxzYbUtnIad7I/j+aVyPlAI=";
|
||||
};
|
||||
xpack-riscv-none-embed-gcc-10_1 = pkgs.callPackage ./nix/xpack-riscv-none-embed-gcc.nix {
|
||||
xpack_toolchain_version = "10.1.0-1.2";
|
||||
xpack_toolchain_hash = "sha256-xg3oiAzqnfIHst+CDTfOq44CtIeD5znCyM/h8qBv4xA=";
|
||||
};
|
||||
xpack-riscv-none-embed-gcc = pkgs.callPackage ./nix/xpack-riscv-none-embed-gcc.nix {
|
||||
xpack_toolchain_version = "10.2.0-1.2";
|
||||
xpack_toolchain_hash = "sha256-1yvc0e7kHcWiCKigOXa3DQFFEN61iQyehzjoBLoj+YU=";
|
||||
};
|
||||
xpack-riscv-none-elf-gcc-11_3 = pkgs.callPackage ./nix/xpack-riscv-none-elf-gcc.nix {
|
||||
xpack_toolchain_version = "11.3.0-1";
|
||||
xpack_toolchain_hash = "sha256-HJn7FXP/LtXe/85ky5a7knLzUfBUaExJ39WtQcbdgE0=";
|
||||
};
|
||||
xpack-riscv-none-elf-gcc-12_3 = pkgs.callPackage ./nix/xpack-riscv-none-elf-gcc.nix {
|
||||
xpack_toolchain_version = "12.3.0-2";
|
||||
xpack_toolchain_hash = "sha256-mSHWPARhGVSvAWucp0zVLBzLgygA0yHWfk5lHxYUbRY=";
|
||||
};
|
||||
xpack-riscv-none-elf-gcc = pkgs.callPackage ./nix/xpack-riscv-none-elf-gcc.nix {
|
||||
xpack_toolchain_version = "13.2.0-1";
|
||||
xpack_toolchain_hash = "sha256-1+/1xdd4hzw9SG5dLIBbglgucwgfk+2zdaHvXYR2S0M=";
|
||||
};
|
||||
python = pkgs.python3.withPackages (python-packages: with python-packages; [
|
||||
cbor2
|
||||
click
|
||||
cryptography
|
||||
intelhex
|
||||
pyyaml
|
||||
]);
|
||||
wchisp = pkgs.callPackage ./nix/wchisp.nix {};
|
||||
in
|
||||
|
||||
pkgs.mkShell {
|
||||
buildInputs = with pkgs; [
|
||||
hidapi
|
||||
libjaylink
|
||||
libusb1
|
||||
mbedtls
|
||||
ncurses5
|
||||
cmake
|
||||
ccache
|
||||
] ++ [
|
||||
libmcuupdate
|
||||
mrs-toolchain
|
||||
xpack-riscv-none-elf-gcc
|
||||
python
|
||||
wchisp
|
||||
];
|
||||
}
|
Loading…
Reference in New Issue
Block a user