forked from M-Labs/artiq
1
0
Fork 0

flake: switch to nightly rust with mozilla overlay

This commit is contained in:
Sebastien Bourdeauducq 2021-08-16 14:53:15 +08:00 committed by occheung
parent 1b516b16e2
commit 8c468d0346
2 changed files with 128 additions and 92 deletions

View File

@ -1,5 +1,21 @@
{ {
"nodes": { "nodes": {
"mozilla-overlay": {
"flake": false,
"locked": {
"lastModified": 1627922300,
"narHash": "sha256-/5fyO/265Wrli2pHpe1/i9Lu8XnQ5K+2YLz9Sz568cI=",
"owner": "mozilla",
"repo": "nixpkgs-mozilla",
"rev": "b1001ed670666ca4ce1c1b064481f88694315c1d",
"type": "github"
},
"original": {
"owner": "mozilla",
"repo": "nixpkgs-mozilla",
"type": "github"
}
},
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1628696776, "lastModified": 1628696776,
@ -18,6 +34,7 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"mozilla-overlay": "mozilla-overlay",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"src-pythonparser": "src-pythonparser", "src-pythonparser": "src-pythonparser",
"src-sipyco": "src-sipyco" "src-sipyco": "src-sipyco"

View File

@ -2,44 +2,65 @@
description = "A leading-edge control system for quantum information experiments"; description = "A leading-edge control system for quantum information experiments";
inputs.nixpkgs.url = github:NixOS/nixpkgs/nixos-21.05; inputs.nixpkgs.url = github:NixOS/nixpkgs/nixos-21.05;
inputs.mozilla-overlay = { url = github:mozilla/nixpkgs-mozilla; flake = false; };
inputs.src-sipyco = { url = github:m-labs/sipyco; flake = false; }; inputs.src-sipyco = { url = github:m-labs/sipyco; flake = false; };
inputs.src-pythonparser = { url = github:m-labs/pythonparser; flake = false; }; inputs.src-pythonparser = { url = github:m-labs/pythonparser; flake = false; };
outputs = { self, nixpkgs, src-sipyco, src-pythonparser }: with import nixpkgs { system = "x86_64-linux"; }; rec { outputs = { self, nixpkgs, mozilla-overlay, src-sipyco, src-pythonparser }:
let
pkgs = import nixpkgs { system = "x86_64-linux"; overlays = [ (import mozilla-overlay) ]; };
rustManifest = pkgs.fetchurl {
url = "https://static.rust-lang.org/dist/2021-01-29/channel-rust-nightly.toml";
sha256 = "sha256-EZKgw89AH4vxaJpUHmIMzMW/80wAFQlfcxRoBD9nz0c=";
};
targets = [];
rustChannelOfTargets = _channel: _date: targets:
(pkgs.lib.rustLib.fromManifestFile rustManifest {
inherit (pkgs) stdenv lib fetchurl patchelf;
}).rust.override {
inherit targets;
extensions = ["rust-src"];
};
rust = rustChannelOfTargets "nightly" null targets;
rustPlatform = pkgs.recurseIntoAttrs (pkgs.makeRustPlatform {
rustc = rust;
cargo = rust;
});
in rec {
packages.x86_64-linux = rec { packages.x86_64-linux = rec {
sipyco = python3Packages.buildPythonPackage { sipyco = pkgs.python3Packages.buildPythonPackage {
name = "sipyco"; name = "sipyco";
src = src-sipyco; src = src-sipyco;
propagatedBuildInputs = with python3Packages; [ pybase64 numpy ]; propagatedBuildInputs = with pkgs.python3Packages; [ pybase64 numpy ];
}; };
pythonparser = python3Packages.buildPythonPackage { pythonparser = pkgs.python3Packages.buildPythonPackage {
name = "pythonparser"; name = "pythonparser";
src = src-pythonparser; src = src-pythonparser;
doCheck = false; doCheck = false;
propagatedBuildInputs = with python3Packages; [ regex ]; propagatedBuildInputs = with pkgs.python3Packages; [ regex ];
}; };
qasync = python3Packages.buildPythonPackage rec { qasync = pkgs.python3Packages.buildPythonPackage rec {
pname = "qasync"; pname = "qasync";
version = "0.10.0"; version = "0.10.0";
src = fetchFromGitHub { src = pkgs.fetchFromGitHub {
owner = "CabbageDevelopment"; owner = "CabbageDevelopment";
repo = "qasync"; repo = "qasync";
rev = "v${version}"; rev = "v${version}";
sha256 = "1zga8s6dr7gk6awmxkh4pf25gbg8n6dv1j4b0by7y0fhi949qakq"; sha256 = "1zga8s6dr7gk6awmxkh4pf25gbg8n6dv1j4b0by7y0fhi949qakq";
}; };
propagatedBuildInputs = [ python3Packages.pyqt5 ]; propagatedBuildInputs = [ pkgs.python3Packages.pyqt5 ];
checkInputs = [ python3Packages.pytest ]; checkInputs = [ pkgs.python3Packages.pytest ];
checkPhase = '' checkPhase = ''
pytest -k 'test_qthreadexec.py' # the others cause the test execution to be aborted, I think because of asyncio pytest -k 'test_qthreadexec.py' # the others cause the test execution to be aborted, I think because of asyncio
''; '';
}; };
outputcheck = python3Packages.buildPythonApplication rec { outputcheck = pkgs.python3Packages.buildPythonApplication rec {
pname = "outputcheck"; pname = "outputcheck";
version = "0.4.2"; version = "0.4.2";
src = fetchFromGitHub { src = pkgs.fetchFromGitHub {
owner = "stp"; owner = "stp";
repo = "OutputCheck"; repo = "OutputCheck";
rev = "e0f533d3c5af2949349856c711bf4bca50022b48"; rev = "e0f533d3c5af2949349856c711bf4bca50022b48";
@ -48,14 +69,12 @@
prePatch = "echo ${version} > RELEASE-VERSION"; prePatch = "echo ${version} > RELEASE-VERSION";
}; };
libartiq-support = stdenv.mkDerivation { libartiq-support = pkgs.stdenv.mkDerivation {
name = "libartiq-support"; name = "libartiq-support";
src = self; src = self;
buildInputs = [ rustc ]; buildInputs = [ rustPlatform.rust.rustc ];
buildPhase = '' buildPhase = ''
# Obviously, #[feature()] can in fact be used on the stable channel, contrary to what the rustc error message says. rustc $src/artiq/test/libartiq_support/lib.rs -Cpanic=unwind -g
# You just need to set this obscure RUSTC_BOOTSTRAP environment variable.
RUSTC_BOOTSTRAP=1 rustc $src/artiq/test/libartiq_support/lib.rs -Cpanic=unwind -g
''; '';
installPhase = '' installPhase = ''
mkdir $out mkdir $out
@ -63,17 +82,17 @@
''; '';
}; };
artiq = python3Packages.buildPythonPackage rec { artiq = pkgs.python3Packages.buildPythonPackage rec {
pname = "artiq"; pname = "artiq";
version = "7.0-dev"; version = "7.0-dev";
src = self; src = self;
preBuild = "export VERSIONEER_OVERRIDE=${version}"; preBuild = "export VERSIONEER_OVERRIDE=${version}";
nativeBuildInputs = [ qt5.wrapQtAppsHook ]; nativeBuildInputs = [ pkgs.qt5.wrapQtAppsHook ];
# keep llvm_x and lld_x in sync with llvmlite # keep llvm_x and lld_x in sync with llvmlite
propagatedBuildInputs = [ llvm_9 lld_9 sipyco pythonparser ] propagatedBuildInputs = [ pkgs.llvm_9 pkgs.lld_9 sipyco pythonparser ]
++ (with python3Packages; [ pyqtgraph pygit2 numpy dateutil scipy prettytable pyserial python-Levenshtein h5py pyqt5 qasync llvmlite ]); ++ (with pkgs.python3Packages; [ pyqtgraph pygit2 numpy dateutil scipy prettytable pyserial python-Levenshtein h5py pyqt5 qasync llvmlite ]);
dontWrapQtApps = true; dontWrapQtApps = true;
postFixup = '' postFixup = ''
@ -86,11 +105,11 @@
# Allows subprocesses using python to find all packages you have installed # Allows subprocesses using python to find all packages you have installed
makeWrapperArgs = [ makeWrapperArgs = [
''--run 'if [ ! -z "$NIX_PYTHONPREFIX" ]; then export PATH=$NIX_PYTHONPREFIX/bin:$PATH;fi' '' ''--run 'if [ ! -z "$NIX_PYTHONPREFIX" ]; then export PATH=$NIX_PYTHONPREFIX/bin:$PATH;fi' ''
"--set FONTCONFIG_FILE ${fontconfig.out}/etc/fonts/fonts.conf" "--set FONTCONFIG_FILE ${pkgs.fontconfig.out}/etc/fonts/fonts.conf"
]; ];
# FIXME: automatically propagate lld_9 llvm_9 dependencies # FIXME: automatically propagate lld_9 llvm_9 dependencies
checkInputs = [ lld_9 llvm_9 outputcheck lit ]; checkInputs = [ pkgs.lld_9 pkgs.llvm_9 pkgs.lit outputcheck ];
checkPhase = '' checkPhase = ''
python -m unittest discover -v artiq.test python -m unittest discover -v artiq.test
@ -102,7 +121,7 @@
}; };
}; };
defaultPackage.x86_64-linux = python3.withPackages(ps: [ packages.x86_64-linux.artiq ]); defaultPackage.x86_64-linux = pkgs.python3.withPackages(ps: [ packages.x86_64-linux.artiq ]);
}; };
nixConfig = { nixConfig = {