From ae296449b03e2deac9065a35e9e2e3dea24c1fe3 Mon Sep 17 00:00:00 2001 From: Las Safin Date: Thu, 16 Sep 2021 12:16:15 +0000 Subject: [PATCH] wip --- nix/ilang.nix | 4 +++- nix/soc.nix | 33 +++++++++++++++++++++++++++++++++ nix/verilog.nix | 4 +--- 3 files changed, 37 insertions(+), 4 deletions(-) create mode 100644 nix/soc.nix diff --git a/nix/ilang.nix b/nix/ilang.nix index c5f548f2..14099df4 100644 --- a/nix/ilang.nix +++ b/nix/ilang.nix @@ -11,11 +11,13 @@ stdenv.mkDerivation { strictDeps = true; nativeBuildInputs = (with python3Packages; [ - python migen + python migen c4m-jtag nmigen-soc python libresoc-ieee754fpu libresoc-openpower-isa ]) ++ (with litexPkgs; [ litex litedram liteeth liteiclink litescope litesdcard ]); postPatch = '' patchShebangs --build . + + export PYTHONPATH="${../src}:$PYTHONPATH" ''; configurePhase = "true"; diff --git a/nix/soc.nix b/nix/soc.nix new file mode 100644 index 00000000..3df35810 --- /dev/null +++ b/nix/soc.nix @@ -0,0 +1,33 @@ +{ version }: + +{ lib, buildPythonPackage, yosys, runCommand, c4m-jtag, nmigen-soc +, libresoc-ieee754fpu, libresoc-openpower-isa, python }: + +let + # If we use ../. as source, then any change to + # any unrelated Nix file would cause a rebuild, + # since the build would have access to it. + src = runCommand "libresoc-soc-source" {} '' + mkdir $out + cp -r ${../src} -T $out/src + cp -r ${../pinmux} -T $out/pinmux + cp -r ${../setup.py} -T $out/setup.py + ''; +in +buildPythonPackage { + pname = "libresoc-soc"; + inherit version src; + + propagatedBuildInputs = [ + c4m-jtag nmigen-soc python libresoc-ieee754fpu libresoc-openpower-isa yosys + ]; + + doCheck = false; + + pythonImportsCheck = [ "soc" ]; + + meta = with lib; { + homepage = "https://libre-soc.org/"; + license = licenses.lgpl3Plus; + }; +} diff --git a/nix/verilog.nix b/nix/verilog.nix index 4ba3727c..89bbdb83 100644 --- a/nix/verilog.nix +++ b/nix/verilog.nix @@ -16,9 +16,7 @@ let in stdenv.mkDerivation { pname = "libresoc.v"; - inherit version; - - inherit src; + inherit version src; strictDeps = true; -- 2.30.2