From 04c482e2f40f76d79c84b7dae6210a271e0f0805 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Fri, 15 Feb 2019 18:17:34 +0800 Subject: [PATCH] cleanup and move board packages to default.nix for installation from channel --- artiq/artiq-board.nix | 1 - artiq/artiq-dev.nix | 2 +- artiq/conda-artiq-board.nix | 2 +- artiq/conda-artiq.nix | 4 ++-- artiq/conda-build.nix | 2 +- artiq/default.nix | 25 ++++++++++++++++++++++++- artiq/shell.nix | 3 ++- main.nix | 30 ++---------------------------- 8 files changed, 33 insertions(+), 36 deletions(-) diff --git a/artiq/artiq-board.nix b/artiq/artiq-board.nix index c535154..b501d33 100644 --- a/artiq/artiq-board.nix +++ b/artiq/artiq-board.nix @@ -5,7 +5,6 @@ { target, variant, buildCommand ? "python -m artiq.gateware.targets.${target} -V ${variant}" }: let - artiqPkgs = import ./default.nix { inherit pkgs; }; fetchcargo = import ./fetchcargo.nix { inherit (pkgs) stdenv cacert git cargo cargo-vendor; }; diff --git a/artiq/artiq-dev.nix b/artiq/artiq-dev.nix index 33e888d..bf90832 100644 --- a/artiq/artiq-dev.nix +++ b/artiq/artiq-dev.nix @@ -1,4 +1,4 @@ -{ pkgs ? import {}}: +{ pkgs }: let artiqpkgs = import ./default.nix { inherit pkgs; }; diff --git a/artiq/conda-artiq-board.nix b/artiq/conda-artiq-board.nix index 5916831..78d3b6b 100644 --- a/artiq/conda-artiq-board.nix +++ b/artiq/conda-artiq-board.nix @@ -1,4 +1,4 @@ -{ pkgs ? import {}}: +{ pkgs }: { artiqSrc, boardBinaries, target, variant }: with pkgs; diff --git a/artiq/conda-artiq.nix b/artiq/conda-artiq.nix index f90f103..ba8ba25 100644 --- a/artiq/conda-artiq.nix +++ b/artiq/conda-artiq.nix @@ -1,9 +1,9 @@ -{ pkgs ? import {}}: -{ artiqSrc }: +{ pkgs }: with pkgs; let + artiqSrc = import ./pkgs/artiq-src.nix { inherit fetchgit; }; fakeCondaSource = runCommand "fake-condasrc-artiq" { } '' cp --no-preserve=mode,ownership -R ${artiqSrc} $out diff --git a/artiq/conda-build.nix b/artiq/conda-build.nix index 2213380..416beb2 100644 --- a/artiq/conda-build.nix +++ b/artiq/conda-build.nix @@ -1,7 +1,7 @@ # We need to pass the whole source to conda for the git variables to work. # recipe must be a string pointing to a path within the source. -{ pkgs ? import {}}: +{ pkgs }: { name, src, recipe }: with pkgs; diff --git a/artiq/default.nix b/artiq/default.nix index 5b27187..eb18131 100644 --- a/artiq/default.nix +++ b/artiq/default.nix @@ -7,6 +7,27 @@ let stdenv = overrideCC stdenv gcc6; # with gcc-7: undefined reference to `__divmoddi4' }); llvm-src = callPackage ./fetch-llvm-clang.nix {}; + + boards = [ + { target = "kasli"; variant = "tester"; } + { target = "kc705"; variant = "nist_clock"; } + ]; + boardPackages = pkgs.lib.lists.foldr (board: start: + let + boardBinaries = import ./artiq-board.nix { inherit pkgs; } { + target = board.target; + variant = board.variant; + }; + in + start // { + "artiq-board-${board.target}-${board.variant}" = boardBinaries; + "conda-artiq-board-${board.target}-${board.variant}" = import ./conda-artiq-board.nix { inherit pkgs; } { + artiqSrc = import ./pkgs/artiq-src.nix { fetchgit = pkgs.fetchgit; }; + boardBinaries = boardBinaries; + target = board.target; + variant = board.variant; + }; + }) {} boards; in rec { inherit (rust) rustc; inherit (callPackage ./pkgs/python3Packages.nix {}) migen microscope misoc jesd204b; @@ -15,4 +36,6 @@ in rec { llvmlite = callPackage ./pkgs/llvmlite.nix { inherit llvm-or1k; }; artiq = callPackage ./pkgs/artiq.nix { inherit binutils-or1k; inherit llvm-or1k; inherit llvmlite; }; openocd = callPackage ./pkgs/openocd.nix {}; -} + + conda-artiq = import ./conda-artiq.nix { inherit pkgs; }; +} // boardPackages diff --git a/artiq/shell.nix b/artiq/shell.nix index 2c32415..b35d707 100644 --- a/artiq/shell.nix +++ b/artiq/shell.nix @@ -1,5 +1,6 @@ +{ pkgs ? import {}}: + let - pkgs = import {}; artiqpkgs = import ./default.nix { inherit pkgs; }; in pkgs.mkShell { diff --git a/main.nix b/main.nix index ca84ada..c5281d8 100644 --- a/main.nix +++ b/main.nix @@ -16,34 +16,8 @@ let } EOF ''; - artiqPkgs = import "${generatedNix}/default.nix" { inherit pkgs; }; - - boards = [ - { target = "kasli"; variant = "tester"; } - { target = "kc705"; variant = "nist_clock"; } - ]; - boardJobs = pkgs.lib.lists.foldr (board: start: - let - boardBinaries = import "${generatedNix}/artiq-board.nix" { inherit pkgs; } { - target = board.target; - variant = board.variant; - }; - in - start // { - "artiq-board-${board.target}-${board.variant}" = boardBinaries; - "conda-artiq-board-${board.target}-${board.variant}" = import "${generatedNix}/conda-artiq-board.nix" { inherit pkgs; } { - artiqSrc = import "${generatedNix}/pkgs/artiq-src.nix" { fetchgit = pkgs.fetchgit; }; - boardBinaries = boardBinaries; - target = board.target; - variant = board.variant; - }; - }) {} boards; - - jobs = { - conda-artiq = import "${generatedNix}/conda-artiq.nix" { inherit pkgs; } { - artiqSrc = import "${generatedNix}/pkgs/artiq-src.nix" { fetchgit = pkgs.fetchgit; }; - }; - } // boardJobs // artiqPkgs; + artiqpkgs = import "${generatedNix}/default.nix" { inherit pkgs; }; + jobs = builtins.mapAttrs (key: value: pkgs.lib.hydraJob value) artiqpkgs; in jobs // { channel = pkgs.releaseTools.channel {