nvboard: Init at 0.3
This commit is contained in:
parent
6133fb20e3
commit
996408c835
4 changed files with 74 additions and 4 deletions
|
@ -8,13 +8,16 @@
|
|||
|
||||
{ pkgs ? import <nixpkgs> { } }:
|
||||
|
||||
with pkgs;
|
||||
|
||||
{
|
||||
# The `lib`, `modules`, and `overlay` names are special
|
||||
lib = import ./lib { inherit pkgs; }; # functions
|
||||
modules = import ./modules; # NixOS modules
|
||||
overlays = import ./overlays; # nixpkgs overlays
|
||||
|
||||
example-package = pkgs.callPackage ./pkgs/example-package { };
|
||||
example-package = callPackage ./pkgs/example-package { };
|
||||
nvboard = callPackage ./pkgs/nvboard { };
|
||||
# some-qt5-package = pkgs.libsForQt5.callPackage ./pkgs/some-qt5-package { };
|
||||
# ...
|
||||
}
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1624561540,
|
||||
"narHash": "sha256-izJ2PYZMGMsSkg+e7c9A1x3t/yOLT+qzUM6WQsc2tqo=",
|
||||
"lastModified": 1704161960,
|
||||
"narHash": "sha256-QGua89Pmq+FBAro8NriTuoO/wNaUtugt29/qqA8zeeM=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "c6a049a3d32293b24c0f894a840872cf67fd7c11",
|
||||
"rev": "63143ac2c9186be6d9da6035fa22620018c85932",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
51
pkgs/nvboard/default.nix
Normal file
51
pkgs/nvboard/default.nix
Normal file
|
@ -0,0 +1,51 @@
|
|||
{ stdenv
|
||||
, fetchFromGitHub
|
||||
, lib
|
||||
, SDL2
|
||||
, SDL2_image
|
||||
, python3
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
name = "nvboard";
|
||||
version = "0.3";
|
||||
src = fetchFromGitHub {
|
||||
owner = "NJU-ProjectN";
|
||||
repo = "nvboard";
|
||||
rev = "23e79f86a6f915592cdf0af1c045a6f96082823c";
|
||||
hash = "sha256-/sC2XD19MVgwKJH/rdCsfewR/Yf7cyd9okQV/AErP+k=";
|
||||
};
|
||||
patches = [ ./fixpics.patch ];
|
||||
|
||||
propagatedBuildInputs = [
|
||||
SDL2
|
||||
SDL2_image
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
python3
|
||||
];
|
||||
|
||||
buildPhase = ''
|
||||
export CXXFLAGS="-DNVBOARD_HOME=\\\"$out/share/nvboard\\\""
|
||||
echo $CXXFLAGS
|
||||
make NVBOARD_HOME=$(pwd) -f ./scripts/nvboard.mk
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/lib
|
||||
mkdir -p $out/include
|
||||
mkdir -p $out/bin
|
||||
mkdir -p $out/share/nvboard/pic
|
||||
mkdir -p $out/share/nvboard/board
|
||||
|
||||
cp ./build/nvboard.a $out/lib/libnvboard.a
|
||||
cp ./include/* $out/include/
|
||||
cp ./pic/* $out/share/nvboard/pic
|
||||
cp ./board/* $out/share/nvboard/board
|
||||
|
||||
# Pin binding script
|
||||
sed -i "s|os.environ.get('NVBOARD_HOME')|\"$out/share/nvboard\"|g" ./scripts/auto_pin_bind.py
|
||||
install ./scripts/auto_pin_bind.py $out/bin/auto_pin_bind
|
||||
'';
|
||||
}
|
16
pkgs/nvboard/fixpics.patch
Normal file
16
pkgs/nvboard/fixpics.patch
Normal file
|
@ -0,0 +1,16 @@
|
|||
diff --git a/src/nvboard.cpp b/src/nvboard.cpp
|
||||
index ff6a75c..3759ff7 100644
|
||||
--- a/src/nvboard.cpp
|
||||
+++ b/src/nvboard.cpp
|
||||
@@ -82,7 +82,11 @@ void nvboard_init(int vga_clk_cycle) {
|
||||
0
|
||||
);
|
||||
|
||||
+#ifdef NVBOARD_HOME
|
||||
+ nvboard_home = NVBOARD_HOME;
|
||||
+#else
|
||||
nvboard_home = getenv("NVBOARD_HOME");
|
||||
+#endif
|
||||
|
||||
load_background(main_renderer);
|
||||
load_texture(main_renderer);
|
Loading…
Reference in a new issue