From 2777a6e05f04106c87b8b7a441e99bde98e43e2f Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Mon, 18 Apr 2022 23:57:57 +0800 Subject: [PATCH] flake: use nac3devices example for PGO --- flake.lock | 23 ++++++++++++++++++++++- flake.nix | 26 +++++++++++++++++++++----- 2 files changed, 43 insertions(+), 6 deletions(-) diff --git a/flake.lock b/flake.lock index 2be48addd..071eb3801 100644 --- a/flake.lock +++ b/flake.lock @@ -18,7 +18,28 @@ }, "root": { "inputs": { - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs", + "sipyco": "sipyco" + } + }, + "sipyco": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1649724535, + "narHash": "sha256-15Nun4EY35j+6SPZkjzZtyH/ncxLS60KuGJjFh5kSTc=", + "owner": "m-labs", + "repo": "sipyco", + "rev": "939f84f9b5eef7efbf7423c735d1834783b6140e", + "type": "github" + }, + "original": { + "owner": "m-labs", + "repo": "sipyco", + "type": "github" } } }, diff --git a/flake.nix b/flake.nix index bbe512f04..b15d9058d 100644 --- a/flake.nix +++ b/flake.nix @@ -2,8 +2,10 @@ description = "The third-generation ARTIQ compiler"; inputs.nixpkgs.url = github:NixOS/nixpkgs/nixos-21.11; + inputs.sipyco.url = github:m-labs/sipyco; + inputs.sipyco.inputs.nixpkgs.follows = "nixpkgs"; - outputs = { self, nixpkgs }: + outputs = { self, nixpkgs, sipyco }: let pkgs = import nixpkgs { system = "x86_64-linux"; }; in rec { @@ -81,11 +83,25 @@ ); nac3artiq-profile = pkgs.stdenvNoCC.mkDerivation { name = "nac3artiq-profile"; - src = self; - buildInputs = [ (python3-mimalloc.withPackages(ps: [ ps.numpy nac3artiq-instrumented ])) pkgs.lld_13 pkgs.llvmPackages_13.libllvm ]; + src = pkgs.fetchFromGitHub { + owner = "m-labs"; + repo = "artiq"; + rev = "dd57fdc530baf926a5f354dc1c2bd90564affd96"; + sha256 = "sha256-hcqVcToYWkc3oDFkKr9wZUF65ydiSYVHdmiGiu2Mc1c="; + }; + buildInputs = [ + (python3-mimalloc.withPackages(ps: [ ps.numpy ps.jsonschema sipyco.packages.x86_64-linux.sipyco nac3artiq-instrumented ])) + pkgs.lld_13 + pkgs.llvmPackages_13.libllvm + ]; phases = [ "buildPhase" "installPhase" ]; - # TODO: get more representative code. - buildPhase = "python $src/nac3artiq/demo/demo.py"; + buildPhase = + '' + export PYTHONPATH=$src + python -m artiq.frontend.artiq_ddb_template $src/artiq/examples/nac3devices/nac3devices.json > device_db.py + cp $src/artiq/examples/nac3devices/nac3devices.py . + python -m artiq.frontend.artiq_compile nac3devices.py + ''; installPhase = '' mkdir $out