From f1325dce2941dbc127654e13b8acffdc151e5ffa Mon Sep 17 00:00:00 2001 From: Stephan Maka Date: Wed, 17 Jun 2020 22:39:41 +0200 Subject: [PATCH] artiq-board.nix: move inputs outside inner function, accept vivado as arg to cut memory usage --- artiq-fast/artiq-board.nix | 16 +++++++++------- artiq-full.nix | 3 ++- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/artiq-fast/artiq-board.nix b/artiq-fast/artiq-board.nix index f74b0c9..bbc2b9f 100644 --- a/artiq-fast/artiq-board.nix +++ b/artiq-fast/artiq-board.nix @@ -1,11 +1,9 @@ # Install Vivado in /opt and add to /etc/nixos/configuration.nix: # nix.sandboxPaths = ["/opt"]; -{ pkgs }: -{ target -, variant -, buildCommand ? "python -m artiq.gateware.targets.${target} -V ${variant}" -, extraInstallCommands ? ""}: +{ pkgs +, vivado ? import ./vivado.nix { inherit pkgs; } +}: let artiqSrc = import ./pkgs/artiq-src.nix { fetchgit = pkgs.fetchgit; }; @@ -44,11 +42,15 @@ let ''; }; - vivado = import ./vivado.nix { inherit pkgs; }; +in +{ target +, variant +, buildCommand ? "python -m artiq.gateware.targets.${target} -V ${variant}" +, extraInstallCommands ? ""}: # Board packages are Python modules so that they get added to the ARTIQ Python # environment, and artiq_flash finds them. -in pkgs.python3Packages.toPythonModule (pkgs.stdenv.mkDerivation rec { +pkgs.python3Packages.toPythonModule (pkgs.stdenv.mkDerivation rec { name = "artiq-board-${target}-${variant}-${version}"; version = import ./pkgs/artiq-version.nix (with pkgs; { inherit stdenv fetchgit git; }); phases = [ "buildPhase" "installCheckPhase" "installPhase" ]; diff --git a/artiq-full.nix b/artiq-full.nix index 41d5ab2..a9dda39 100644 --- a/artiq-full.nix +++ b/artiq-full.nix @@ -100,7 +100,8 @@ let "uamsterdam" ]); - artiq-board = import ./fast/artiq-board.nix { inherit pkgs; }; + vivado = import ./fast/vivado.nix { inherit pkgs; }; + artiq-board = import ./fast/artiq-board.nix { inherit pkgs vivado; }; conda-artiq-board = import ./conda-artiq-board.nix { inherit pkgs; }; src = pkgs.fetchgit { url = "https://git.m-labs.hk/M-Labs/sinara-systems.git";