From 47960f539b85b05797c9596e56eda59ea148a3f7 Mon Sep 17 00:00:00 2001 From: Drew Risinger Date: Mon, 10 Jan 2022 09:26:11 -0500 Subject: [PATCH] shells (artiq-fast): change artiqpkgs, vivado to arguments This allows overriding the artiqpkgs used downstream. The issue is that previously artiqpkgs required to be defined, and overriding that required setting paths, added complexity, and possible impurities. This solution allows reuse of the shell[-dev], from a given version of ARTIQ, without necessarily specifying source or a local source repo. --- artiq-fast/shell-dev.nix | 39 +++++++++++++++++++-------------------- artiq-fast/shell.nix | 13 ++++++------- 2 files changed, 25 insertions(+), 27 deletions(-) diff --git a/artiq-fast/shell-dev.nix b/artiq-fast/shell-dev.nix index aff6905..4e705b8 100644 --- a/artiq-fast/shell-dev.nix +++ b/artiq-fast/shell-dev.nix @@ -1,21 +1,20 @@ -{ pkgs ? import {}}: +{ pkgs ? import {} +, artiqpkgs ? import ./default.nix { inherit pkgs; } +, vivado ? import ./vivado.nix { inherit pkgs; } +}: -let - artiqpkgs = import ./default.nix { inherit pkgs; }; - vivado = import ./vivado.nix { inherit pkgs; }; -in - assert pkgs.lib.asserts.assertMsg (!pkgs.lib.strings.versionAtLeast artiqpkgs.artiq.version "7.0") "For ARTIQ 7+, use 'nix develop' on the flake instead."; - pkgs.mkShell { - buildInputs = [ - vivado - pkgs.gnumake - (pkgs.python3.withPackages(ps: (with ps; [ jinja2 jsonschema numpy paramiko ]) ++ (with artiqpkgs; [ migen microscope misoc jesd204b migen-axi artiq ]))) - artiqpkgs.cargo-legacy - artiqpkgs.rustc-legacy - artiqpkgs.binutils-or1k - artiqpkgs.binutils-arm - artiqpkgs.llvm-or1k - artiqpkgs.openocd - ]; - TARGET_AR="or1k-linux-ar"; - } +assert pkgs.lib.asserts.assertMsg (!pkgs.lib.strings.versionAtLeast artiqpkgs.artiq.version "7.0") "For ARTIQ 7+, use 'nix develop' on the flake instead."; +pkgs.mkShell { + buildInputs = [ + vivado + pkgs.gnumake + (pkgs.python3.withPackages(ps: (with ps; [ jinja2 jsonschema numpy paramiko ]) ++ (with artiqpkgs; [ migen microscope misoc jesd204b migen-axi artiq ]))) + artiqpkgs.cargo-legacy + artiqpkgs.rustc-legacy + artiqpkgs.binutils-or1k + artiqpkgs.binutils-arm + artiqpkgs.llvm-or1k + artiqpkgs.openocd + ]; + TARGET_AR="or1k-linux-ar"; +} diff --git a/artiq-fast/shell.nix b/artiq-fast/shell.nix index 0f14cc3..b456bac 100644 --- a/artiq-fast/shell.nix +++ b/artiq-fast/shell.nix @@ -1,8 +1,7 @@ -{ pkgs ? import {}}: +{ pkgs ? import {} +, artiqpkgs ? import ./default.nix { inherit pkgs; } +}: -let - artiqpkgs = import ./default.nix { inherit pkgs; }; -in - pkgs.mkShell { - buildInputs = [ (pkgs.python3.withPackages(ps: [artiqpkgs.artiq])) ]; - } +pkgs.mkShell { + buildInputs = [ (pkgs.python3.withPackages(ps: [artiqpkgs.artiq])) ]; +} -- 2.42.0