summary refs log tree commit diff
path: root/pkgs/development/tools/misc
diff options
context:
space:
mode:
authorLuflosi <luflosi@luflosi.de>2020-05-09 15:22:04 +0200
committerLuflosi <luflosi@luflosi.de>2021-07-22 14:49:49 +0200
commitdb7aa804f52a66925b9880fe953eb5d323036719 (patch)
tree80a7a453899c55120eb907ccbf57206d021cd25e /pkgs/development/tools/misc
parentf102bcee7d1f3f607ad502dfe346f4d4066e534a (diff)
downloadnixpkgs-db7aa804f52a66925b9880fe953eb5d323036719.tar
nixpkgs-db7aa804f52a66925b9880fe953eb5d323036719.tar.gz
nixpkgs-db7aa804f52a66925b9880fe953eb5d323036719.tar.bz2
nixpkgs-db7aa804f52a66925b9880fe953eb5d323036719.tar.lz
nixpkgs-db7aa804f52a66925b9880fe953eb5d323036719.tar.xz
nixpkgs-db7aa804f52a66925b9880fe953eb5d323036719.tar.zst
nixpkgs-db7aa804f52a66925b9880fe953eb5d323036719.zip
apio: init at 0.7.4
I use this package for programming a TinyFPGA BX. It will probably not work with FPGAs which are not TinyFPGA boards, without modification.
Diffstat (limited to 'pkgs/development/tools/misc')
-rw-r--r--pkgs/development/tools/misc/apio/default.nix69
1 files changed, 69 insertions, 0 deletions
diff --git a/pkgs/development/tools/misc/apio/default.nix b/pkgs/development/tools/misc/apio/default.nix
new file mode 100644
index 00000000000..b810910f7fe
--- /dev/null
+++ b/pkgs/development/tools/misc/apio/default.nix
@@ -0,0 +1,69 @@
+{ lib
+, buildPythonApplication
+, fetchFromGitHub
+, click
+, semantic-version
+, requests
+, colorama
+, pyserial
+, wheel
+, setuptools
+, tinyprog
+, pytestCheckHook
+}:
+
+buildPythonApplication rec {
+  pname = "apio";
+  version = "0.7.5";
+  format = "flit";
+
+  src = fetchFromGitHub {
+    owner = "FPGAwars";
+    repo = "apio";
+    rev = "v${version}";
+    sha256 = "sha256-9f0q6tELUDo6FdjPG708d7BY3O5ZiZ0FwNFzBBiLQp4=";
+  };
+
+  postPatch = ''
+    substituteInPlace apio/managers/scons.py --replace \
+      'return "tinyprog --libusb --program"' \
+      'return "${tinyprog}/bin/tinyprog --libusb --program"'
+    substituteInPlace apio/util.py --replace \
+      '_command = join(get_bin_dir(), "tinyprog")' \
+      '_command = "${tinyprog}/bin/tinyprog"'
+
+    # semantic-version seems to not support version numbers like the one of tinyprog in Nixpkgs (1.0.24.dev114+gxxxxxxx).
+    # See https://github.com/rbarrois/python-semanticversion/issues/47.
+    # This leads to an error like "Error: Invalid version string: '1.0.24.dev114+g97f6353'"
+    # when executing "apio upload" for a TinyFPGA.
+    # Replace the dot with a dash to work around this problem.
+    substituteInPlace apio/managers/scons.py --replace \
+        'version = semantic_version.Version(pkg_version)' \
+        'version = semantic_version.Version(pkg_version.replace(".dev", "-dev"))'
+  '';
+
+  propagatedBuildInputs = [
+    click
+    semantic-version
+    requests
+    colorama
+    pyserial
+    wheel
+    setuptools # needs pkg_resources at runtime (technically not needed when tinyprog is also in this list because of the propagatedBuildInputs of tinyprog)
+
+    tinyprog # needed for upload to TinyFPGA
+  ];
+
+  checkInputs = [
+    pytestCheckHook
+  ];
+
+  pytestFlagsArray = [ "--offline" ];
+
+  meta = with lib; {
+    description = "Open source ecosystem for open FPGA boards";
+    homepage = "https://github.com/FPGAwars/apio";
+    license = licenses.gpl2Only;
+    maintainers = with maintainers; [ Luflosi ];
+  };
+}