Got it working, thanks! For anyone else who's curious, this was my solution:
{ pkgs ? import <nixpkgs> {}, artiq-board, <our_packages>, artiqpkgs }:
{
target,
variant,
src ? null,
buildCommand ? "python -m <our_gateware>.targets.${target} ${variant}",
extraInstallCommands ? "",
...
}:
(artiq-board { inherit target variant src buildCommand extraInstallCommands; }).overrideAttrs(oldAttrs: rec {
buildInputs = [ (pkgs.python3.withPackages(ps: with ps; [ jinja2 numpy artiqpkgs.migen artiqpkgs.microscope artiqpkgs.misoc artiqpkgs.jesd204b artiqpkgs.artiq <our_packages>.<our_gateware> ])) ];
}) # todo: not sure how to inherit the "...", or whether it's necessary to do so
Then in my main build script I import fast/default.nix
and fast/artiq-board.nix
from the channel tarball and import the above file with those arguments - then that can be used in the same way as the original artiq-board
.
I also tried simply doing
buildInputs = oldAttrs.buildInputs ++ [ pkgs.python3.withPackages(ps: [ <our_packages>.<our_gateware> ]) ];
in order to avoid the need to copy the existing build inputs (and the need to have artiqpkgs
as an input), but unfortunately that creates two separate python environments.
@Astro do you have any comments regarding my todo
?