1
0
forked from M-Labs/nac3

switch to Nix flakes

This commit is contained in:
Sebastien Bourdeauducq 2021-10-07 21:49:13 +08:00
parent c697e522d3
commit 79d3c5caae
3 changed files with 72 additions and 17 deletions

27
flake.lock generated Normal file
View File

@ -0,0 +1,27 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1633613384,
"narHash": "sha256-Bn4Jr0vz8kjsKLoqI6THehlt8bpfGnrVxVyBMB8ql94=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "710be10957913238d3f57b598387efba68aa41b8",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "master",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

45
flake.nix Normal file
View File

@ -0,0 +1,45 @@
{
description = "The third-generation ARTIQ compiler";
inputs.nixpkgs.url = github:NixOS/nixpkgs/master;
outputs = { self, nixpkgs }:
let
pkgs = import nixpkgs { system = "x86_64-linux"; };
in {
packages.x86_64-linux = {
nac3artiq = pkgs.python3Packages.toPythonModule (
pkgs.rustPlatform.buildRustPackage {
name = "nac3artiq";
src = self;
cargoSha256 = "0cml3irmc72f42dqmka9w4l3k397b2rnns768vm132mh2zyv85lp";
nativeBuildInputs = [ pkgs.python3 pkgs.llvm_11 ];
buildInputs = [ pkgs.python3 pkgs.libffi pkgs.libxml2 pkgs.llvm_11 ];
cargoBuildFlags = [ "--package" "nac3artiq" ];
cargoTestFlags = [ "--package" "nac3core" "--package" "nac3artiq" ];
installPhase =
''
TARGET_DIR=$out/${pkgs.python3Packages.python.sitePackages}
mkdir -p $TARGET_DIR
cp target/x86_64-unknown-linux-gnu/release/libnac3artiq.so $TARGET_DIR/nac3artiq.so
'';
}
);
};
devShell.x86_64-linux = pkgs.mkShell {
name = "nac3-dev-shell";
buildInputs = with pkgs; [
llvm_11
clang_11
lld_11
cargo
rustc
libffi
libxml2
clippy
(python3.withPackages(ps: [ ps.numpy ]))
];
};
};
}

View File

@ -1,17 +0,0 @@
let
pkgs = import <nixpkgs> { };
in
pkgs.stdenv.mkDerivation {
name = "nac3-env";
buildInputs = with pkgs; [
llvm_11
clang_11
lld_11
cargo
rustc
libffi
libxml2
clippy
(python3.withPackages(ps: [ps.numpy]))
];
}