From 3917a0ef4691912fa506ec2f38636a63585f4898 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Wed, 23 Jan 2019 21:59:39 +0800 Subject: [PATCH] nix: support reusing dev environment in build scripts --- nix/README.rst | 2 +- nix/artiq-dev.nix | 7 ++++--- nix/shell-dev.nix | 4 ++++ 3 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 nix/shell-dev.nix diff --git a/nix/README.rst b/nix/README.rst index f0ac1eb40..24998d2dd 100644 --- a/nix/README.rst +++ b/nix/README.rst @@ -28,7 +28,7 @@ The above command will setup your entire environment. Note that it will compile 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). diff --git a/nix/artiq-dev.nix b/nix/artiq-dev.nix index 7d93ae476..eab47ef59 100644 --- a/nix/artiq-dev.nix +++ b/nix/artiq-dev.nix @@ -1,8 +1,9 @@ +{runScript ? "", extraProfile ? ""}: + let pkgs = import {}; artiqpkgs = import ./default.nix { inherit pkgs; }; in -( pkgs.buildFHSUserEnv { name = "artiq-dev"; targetPkgs = pkgs: ( @@ -29,8 +30,8 @@ in openocd ]) ); + runScript = runScript; profile = '' export TARGET_AR=${artiqpkgs.binutils-or1k}/bin/or1k-linux-ar - ''; + '' + extraProfile; } -).env diff --git a/nix/shell-dev.nix b/nix/shell-dev.nix new file mode 100644 index 000000000..ee2e8a764 --- /dev/null +++ b/nix/shell-dev.nix @@ -0,0 +1,4 @@ +let + artiq-dev = import ./artiq-dev.nix {}; +in + artiq-dev.env