forked from M-Labs/artiq
nix: build board conda package
This commit is contained in:
parent
7c6abfb2ce
commit
8194f74252
|
@ -0,0 +1,60 @@
|
||||||
|
{ pkgs ? import <nixpkgs> {}}:
|
||||||
|
{ artiqSrc, boardBinaries }:
|
||||||
|
|
||||||
|
with pkgs;
|
||||||
|
|
||||||
|
let
|
||||||
|
target = "kasli";
|
||||||
|
variant = "tester";
|
||||||
|
|
||||||
|
fakeCondaSource = runCommand "fake-conda-source-${target}-${variant}" { }
|
||||||
|
''
|
||||||
|
cp --no-preserve=mode,ownership -R ${artiqSrc} $out
|
||||||
|
mkdir $out/fake-conda;
|
||||||
|
|
||||||
|
cat << EOF > $out/fake-conda/meta.yaml
|
||||||
|
package:
|
||||||
|
name: artiq-${target}-${variant}
|
||||||
|
version: {{ environ["GIT_DESCRIBE_TAG"] }}
|
||||||
|
|
||||||
|
source:
|
||||||
|
git_url: ..
|
||||||
|
|
||||||
|
build:
|
||||||
|
noarch: python
|
||||||
|
number: {{ environ["GIT_DESCRIBE_NUMBER"] }}
|
||||||
|
string: {{ environ["GIT_DESCRIBE_NUMBER"] }}+git{{ environ["GIT_FULL_HASH"][:8] }}
|
||||||
|
ignore_prefix_files: True
|
||||||
|
|
||||||
|
outputs:
|
||||||
|
- name: artiq-${target}-${variant}
|
||||||
|
noarch: python
|
||||||
|
files:
|
||||||
|
- site-packages
|
||||||
|
requirements:
|
||||||
|
run:
|
||||||
|
- artiq {{ "{tag} {number}+git{hash}".format(tag=environ["GIT_DESCRIBE_TAG"], number=environ["GIT_DESCRIBE_NUMBER"], hash=environ["GIT_FULL_HASH"][:8]) }}
|
||||||
|
ignore_prefix_files: True
|
||||||
|
|
||||||
|
about:
|
||||||
|
home: https://m-labs.hk/artiq
|
||||||
|
license: LGPL
|
||||||
|
summary: 'Bitstream, BIOS and firmware for the ${target}-${variant} board variant'
|
||||||
|
EOF
|
||||||
|
|
||||||
|
cat << EOF > $out/fake-conda/build.sh
|
||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
SOC_PREFIX=\$PREFIX/site-packages/artiq/binaries/${target}-${variant}
|
||||||
|
mkdir -p \$SOC_PREFIX
|
||||||
|
cp ${boardBinaries}/* \$SOC_PREFIX
|
||||||
|
EOF
|
||||||
|
chmod 755 $out/fake-conda/build.sh
|
||||||
|
'';
|
||||||
|
conda-board = import ./conda-build.nix { inherit pkgs; } {
|
||||||
|
name = "conda-board-${target}-${variant}";
|
||||||
|
src = fakeCondaSource;
|
||||||
|
recipe = "fake-conda";
|
||||||
|
};
|
||||||
|
in
|
||||||
|
conda-board
|
|
@ -1,4 +1,8 @@
|
||||||
|
# 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 <nixpkgs> {}}:
|
{ pkgs ? import <nixpkgs> {}}:
|
||||||
|
{ name, src, recipe }:
|
||||||
|
|
||||||
with pkgs;
|
with pkgs;
|
||||||
|
|
||||||
|
@ -37,8 +41,7 @@ let
|
||||||
};
|
};
|
||||||
|
|
||||||
in stdenv.mkDerivation {
|
in stdenv.mkDerivation {
|
||||||
name = "conda-artiq";
|
inherit name src;
|
||||||
src = ../.;
|
|
||||||
buildInputs = [ condaBuilderEnv ];
|
buildInputs = [ condaBuilderEnv ];
|
||||||
buildCommand =
|
buildCommand =
|
||||||
''
|
''
|
||||||
|
@ -54,7 +57,7 @@ in stdenv.mkDerivation {
|
||||||
- PYTHON
|
- PYTHON
|
||||||
EOF
|
EOF
|
||||||
mkdir $out
|
mkdir $out
|
||||||
${condaBuilderEnv}/bin/conda-builder-env -c "PYTHON=python conda build --clobber-file clobber.yaml --no-anaconda-upload --no-test --output-folder $out $src/conda/artiq"
|
${condaBuilderEnv}/bin/conda-builder-env -c "PYTHON=python conda build --clobber-file clobber.yaml --no-anaconda-upload --no-test --output-folder $out $src/${recipe}"
|
||||||
|
|
||||||
mkdir -p $out/nix-support
|
mkdir -p $out/nix-support
|
||||||
echo file conda $out/noarch/*.tar.bz2 >> $out/nix-support/hydra-build-products
|
echo file conda $out/noarch/*.tar.bz2 >> $out/nix-support/hydra-build-products
|
||||||
|
|
|
@ -1,9 +1,18 @@
|
||||||
{ pkgs ? import <nixpkgs> {}}:
|
{ pkgs ? import <nixpkgs> {}}:
|
||||||
let
|
let
|
||||||
artiqPkgs = import ./default.nix { inherit pkgs; };
|
artiqPkgs = import ./default.nix { inherit pkgs; };
|
||||||
jobs = rec {
|
|
||||||
conda-artiq = import ./conda-build.nix { inherit pkgs; };
|
|
||||||
artiq-board = import ./artiq-board.nix { inherit pkgs; };
|
artiq-board = import ./artiq-board.nix { inherit pkgs; };
|
||||||
|
jobs = rec {
|
||||||
|
conda-artiq = import ./conda-build.nix { inherit pkgs; } {
|
||||||
|
name = "conda-artiq";
|
||||||
|
src = ../.;
|
||||||
|
recipe = "conda/artiq";
|
||||||
|
};
|
||||||
|
inherit artiq-board;
|
||||||
|
conda-artiq-board = import ./conda-board.nix { inherit pkgs; } {
|
||||||
|
artiqSrc = ../.;
|
||||||
|
boardBinaries = artiq-board;
|
||||||
|
};
|
||||||
} // artiqPkgs;
|
} // artiqPkgs;
|
||||||
in
|
in
|
||||||
jobs
|
jobs
|
||||||
|
|
Loading…
Reference in New Issue