nix: support reusing dev environment in build scripts

This commit is contained in:
Sebastien Bourdeauducq 2019-01-23 21:59:39 +08:00
parent 154269b77a
commit 3917a0ef46
3 changed files with 9 additions and 4 deletions

View File

@ -28,7 +28,7 @@ The above command will setup your entire environment. Note that it will compile
ARTIQ development environment with Nix ARTIQ development environment with Nix
====================================== ======================================
Run ``nix-shell artiq-dev.nix`` to obtain an environment containing Migen, MiSoC, Microscope, jesd204b, Clang, Rust, Cargo, and OpenOCD in addition to the user environment above. Run ``nix-shell shell-dev.nix`` to obtain an environment containing Migen, MiSoC, Microscope, jesd204b, Clang, Rust, Cargo, and OpenOCD in addition to the user environment above.
This creates a FHS chroot environment in order to simplify the installation and patching of Xilinx Vivado (it needs to be installed manually e.g. in your home folder). This creates a FHS chroot environment in order to simplify the installation and patching of Xilinx Vivado (it needs to be installed manually e.g. in your home folder).

View File

@ -1,8 +1,9 @@
{runScript ? "", extraProfile ? ""}:
let let
pkgs = import <nixpkgs> {}; pkgs = import <nixpkgs> {};
artiqpkgs = import ./default.nix { inherit pkgs; }; artiqpkgs = import ./default.nix { inherit pkgs; };
in in
(
pkgs.buildFHSUserEnv { pkgs.buildFHSUserEnv {
name = "artiq-dev"; name = "artiq-dev";
targetPkgs = pkgs: ( targetPkgs = pkgs: (
@ -29,8 +30,8 @@ in
openocd openocd
]) ])
); );
runScript = runScript;
profile = '' profile = ''
export TARGET_AR=${artiqpkgs.binutils-or1k}/bin/or1k-linux-ar export TARGET_AR=${artiqpkgs.binutils-or1k}/bin/or1k-linux-ar
''; '' + extraProfile;
} }
).env

4
nix/shell-dev.nix Normal file
View File

@ -0,0 +1,4 @@
let
artiq-dev = import ./artiq-dev.nix {};
in
artiq-dev.env