1
0
Fork 0

clean up bitstream build

Also make the development shell a more ergonomic regular nix-shell instead of the FHS env shell.
This commit is contained in:
Sebastien Bourdeauducq 2019-07-03 20:26:30 +08:00
parent 41a19cbf34
commit 3fe5ce25c5
5 changed files with 59 additions and 45 deletions

View File

@ -8,10 +8,10 @@
, extraInstallCommands ? ""}: , extraInstallCommands ? ""}:
let let
artiqSrc = import ./pkgs/artiq-src.nix { fetchgit = pkgs.fetchgit; };
fetchcargo = import ./fetchcargo.nix { fetchcargo = import ./fetchcargo.nix {
inherit (pkgs) stdenv cacert git cargo cargo-vendor; inherit (pkgs) stdenv cacert git cargo cargo-vendor;
}; };
artiqSrc = import ./pkgs/artiq-src.nix { fetchgit = pkgs.fetchgit; };
cargoDeps = fetchcargo rec { cargoDeps = fetchcargo rec {
name = "artiq-firmware-cargo-deps"; name = "artiq-firmware-cargo-deps";
src = "${artiqSrc}/artiq/firmware"; src = "${artiqSrc}/artiq/firmware";
@ -42,15 +42,27 @@ let
''; '';
}; };
buildenv = import ./artiq-dev.nix { inherit pkgs; }; vivado = import ./vivado.nix { inherit pkgs; };
artiqpkgs = import ./default.nix { inherit pkgs; };
in pkgs.python3Packages.buildPythonPackage rec { in pkgs.stdenv.mkDerivation rec {
name = "artiq-board-${target}-${variant}-${version}"; name = "artiq-board-${target}-${variant}-${version}";
version = import ./pkgs/artiq-version.nix (with pkgs; { inherit stdenv fetchgit git; }); version = import ./pkgs/artiq-version.nix (with pkgs; { inherit stdenv fetchgit git; });
phases = [ "buildPhase" "installCheckPhase" "installPhase" ]; phases = [ "buildPhase" "installCheckPhase" "installPhase" ];
buildInputs = [
vivado
pkgs.gnumake
(pkgs.python3.withPackages(ps: with ps; [ jinja2 numpy artiqpkgs.migen artiqpkgs.microscope artiqpkgs.misoc artiqpkgs.jesd204b artiqpkgs.artiq ]))
pkgs.cargo
artiqpkgs.rustc
artiqpkgs.binutils-or1k
artiqpkgs.llvm-or1k
];
buildPhase = buildPhase =
'' ''
${buildenv}/bin/artiq-dev -c "export CARGO_HOME=${cargoVendored}; ${buildCommand}" export CARGO_HOME=${cargoVendored}
export TARGET_AR=or1k-linux-ar
${buildCommand}
''; '';
checkPhase = '' checkPhase = ''
# Search for PCREs in the Vivado output to check for errors # Search for PCREs in the Vivado output to check for errors

View File

@ -1,35 +0,0 @@
{ pkgs }:
let
artiqpkgs = import ./default.nix { inherit pkgs; };
in
pkgs.buildFHSUserEnv {
name = "artiq-dev";
targetPkgs = pkgs: (
with pkgs; [
ncurses5
gnumake
zlib
libuuid
xorg.libSM
xorg.libICE
xorg.libXrender
xorg.libX11
xorg.libXext
xorg.libXtst
xorg.libXi
(python3.withPackages(ps: with ps; [ jinja2 numpy paramiko artiqpkgs.migen artiqpkgs.microscope artiqpkgs.misoc artiqpkgs.jesd204b artiqpkgs.artiq ]))
git
cargo
] ++
(with artiqpkgs; [
rustc
binutils-or1k
llvm-or1k
openocd
])
);
profile = ''
export TARGET_AR=${artiqpkgs.binutils-or1k}/bin/or1k-linux-ar
'';
}

View File

@ -83,8 +83,8 @@ rec {
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "m-labs"; owner = "m-labs";
repo = "misoc"; repo = "misoc";
rev = "6e9c1a894312a81b534482949cbfc5f47842edd9"; rev = "ba816951606d5463d3d2df9fcc6e143b17b3a8a8";
sha256 = "0y4jh60bmpzzh06k2gzxl3pqzbvvg8ipz029hvmi8d05hzf4kcf3"; sha256 = "06f2fgp46cgkwgjwdlppl73d8c1k960xm5niq96z647lsblj2d16";
fetchSubmodules = true; fetchSubmodules = true;
}; };
@ -107,8 +107,8 @@ rec {
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "m-labs"; owner = "m-labs";
repo = "migen"; repo = "migen";
rev = "5c5486ba9900b1a89a405f4b063dd7faf0e59a4a"; rev = "caab41469f5a0cb4014bc00a03898a0b76b00dd1";
sha256 = "116c5sc8814xmbb99h7sd0j42qak0b5xpl4276lyi2ap4swmxd4h"; sha256 = "06zbbbjzlbyq2nlp13hyk8diw06zrffc37n4b6cxzk1i2aq8g83m";
}; };
propagatedBuildInputs = with python3Packages; [ colorama sphinx sphinx_rtd_theme ]; propagatedBuildInputs = with python3Packages; [ colorama sphinx sphinx_rtd_theme ];

View File

@ -1,6 +1,19 @@
{ pkgs ? import <nixpkgs> {}}: { pkgs ? import <nixpkgs> {}}:
let let
artiq-dev = import ./artiq-dev.nix { inherit pkgs; }; artiqpkgs = import ./default.nix { inherit pkgs; };
vivado = import ./vivado.nix { inherit pkgs; };
in in
artiq-dev.env pkgs.mkShell {
buildInputs = [
vivado
pkgs.gnumake
(pkgs.python3.withPackages(ps: with ps; [ jinja2 numpy paramiko artiqpkgs.migen artiqpkgs.microscope artiqpkgs.misoc artiqpkgs.jesd204b artiqpkgs.artiq ]))
pkgs.cargo
artiqpkgs.rustc
artiqpkgs.binutils-or1k
artiqpkgs.llvm-or1k
artiqpkgs.openocd
];
TARGET_AR="or1k-linux-ar";
}

24
artiq/vivado.nix Normal file
View File

@ -0,0 +1,24 @@
# Install Vivado in /opt and add to /etc/nixos/configuration.nix:
# nix.sandboxPaths = ["/opt"];
{ pkgs, vivadoPath ? "/opt/Xilinx/Vivado/2019.1" }:
pkgs.buildFHSUserEnv {
name = "vivado";
targetPkgs = pkgs: (
with pkgs; [
ncurses5
zlib
libuuid
xorg.libSM
xorg.libICE
xorg.libXrender
xorg.libX11
xorg.libXext
xorg.libXtst
xorg.libXi
]
);
profile = "source ${vivadoPath}/settings64.sh";
runScript = "vivado";
}