From 79d3c5caae79fe15f41d2b2248cad2344389555f Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Thu, 7 Oct 2021 21:49:13 +0800 Subject: [PATCH] switch to Nix flakes --- flake.lock | 27 +++++++++++++++++++++++++++ flake.nix | 45 +++++++++++++++++++++++++++++++++++++++++++++ shell.nix | 17 ----------------- 3 files changed, 72 insertions(+), 17 deletions(-) create mode 100644 flake.lock create mode 100644 flake.nix delete mode 100644 shell.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 000000000..21cdf9c78 --- /dev/null +++ b/flake.lock @@ -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 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 000000000..f95db1e53 --- /dev/null +++ b/flake.nix @@ -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 ])) + ]; + }; + }; +} diff --git a/shell.nix b/shell.nix deleted file mode 100644 index 3de8d3782..000000000 --- a/shell.nix +++ /dev/null @@ -1,17 +0,0 @@ -let - pkgs = import { }; -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])) - ]; - }