diff --git a/flake.lock b/flake.lock index 1e28d8359..803cba372 100644 --- a/flake.lock +++ b/flake.lock @@ -42,22 +42,6 @@ "type": "github" } }, - "mozilla-overlay": { - "flake": false, - "locked": { - "lastModified": 1704373101, - "narHash": "sha256-+gi59LRWRQmwROrmE1E2b3mtocwueCQqZ60CwLG+gbg=", - "owner": "mozilla", - "repo": "nixpkgs-mozilla", - "rev": "9b11a87c0cc54e308fa83aac5b4ee1816d5418a2", - "type": "github" - }, - "original": { - "owner": "mozilla", - "repo": "nixpkgs-mozilla", - "type": "github" - } - }, "nixpkgs": { "locked": { "lastModified": 1718437845, @@ -77,14 +61,34 @@ "root": { "inputs": { "artiq-comtools": "artiq-comtools", - "mozilla-overlay": "mozilla-overlay", "nixpkgs": "nixpkgs", + "rust-overlay": "rust-overlay", "sipyco": "sipyco", "src-migen": "src-migen", "src-misoc": "src-misoc", "src-pythonparser": "src-pythonparser" } }, + "rust-overlay": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1718763539, + "narHash": "sha256-JHqQyO5XppLpMSKBaYlxbmPHMc4DpwuavKIch9W+hv4=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "69fcfaebbe564d162a85cadeaadd4dec646be4a2", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, "sipyco": { "inputs": { "nixpkgs": [ diff --git a/flake.nix b/flake.nix index 55a4fb296..c869a5801 100644 --- a/flake.nix +++ b/flake.nix @@ -2,7 +2,10 @@ description = "A leading-edge control system for quantum information experiments"; inputs.nixpkgs.url = github:NixOS/nixpkgs/nixos-24.05; - inputs.mozilla-overlay = { url = github:mozilla/nixpkgs-mozilla; flake = false; }; + inputs.rust-overlay = { + url = "github:oxalica/rust-overlay"; + inputs.nixpkgs.follows = "nixpkgs"; + }; inputs.sipyco.url = github:m-labs/sipyco; inputs.sipyco.inputs.nixpkgs.follows = "nixpkgs"; inputs.src-pythonparser = { url = github:m-labs/pythonparser; flake = false; }; @@ -13,9 +16,9 @@ inputs.src-migen = { url = github:m-labs/migen; flake = false; }; inputs.src-misoc = { type = "git"; url = "https://github.com/m-labs/misoc.git"; submodules = true; flake = false; }; - outputs = { self, nixpkgs, mozilla-overlay, sipyco, src-pythonparser, artiq-comtools, src-migen, src-misoc }: + outputs = { self, nixpkgs, rust-overlay, sipyco, src-pythonparser, artiq-comtools, src-migen, src-misoc }: let - pkgs = import nixpkgs { system = "x86_64-linux"; overlays = [ (import mozilla-overlay) ]; }; + pkgs = import nixpkgs { system = "x86_64-linux"; overlays = [ (import rust-overlay) ]; }; pkgs-aarch64 = import nixpkgs { system = "aarch64-linux"; }; artiqVersionMajor = 9; @@ -24,24 +27,14 @@ artiqVersion = (builtins.toString artiqVersionMajor) + "." + (builtins.toString artiqVersionMinor) + "+" + artiqVersionId + ".beta"; artiqRev = self.sourceInfo.rev or "unknown"; - rustManifest = pkgs.fetchurl { - url = "https://static.rust-lang.org/dist/2021-09-01/channel-rust-nightly.toml"; - sha256 = "sha256-KYLZHfOkotnM6BZd7CU+vBA3w/VtiWxth3ngJlmA41U="; + rust = pkgs.rust-bin.nightly."2021-08-31".default.override { + extensions = [ "rust-src" ]; + targets = [ ]; }; - - 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 { + rustPlatform = pkgs.makeRustPlatform { rustc = rust; cargo = rust; - }); + }; vivadoDeps = pkgs: with pkgs; let # Apply patch from https://github.com/nix-community/nix-environments/pull/54 @@ -252,7 +245,7 @@ vivado rustPlatform.cargoSetupHook ]; - buildPhase = + buildPhase = '' ARTIQ_PATH=`python -c "import artiq; print(artiq.__path__[0])"` ln -s $ARTIQ_PATH/firmware/Cargo.lock .