From 8f041b017caaec50d4980a96b13f559d15991c84 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Sat, 16 Nov 2024 17:13:55 +0800 Subject: [PATCH] switch to oxalica rust overlay --- flake.lock | 41 +++++++++++++++++++++++------------------ flake.nix | 30 ++++++++++++------------------ 2 files changed, 35 insertions(+), 36 deletions(-) diff --git a/flake.lock b/flake.lock index 0e67bb9..b56795a 100644 --- a/flake.lock +++ b/flake.lock @@ -1,21 +1,5 @@ { "nodes": { - "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": 1727540905, @@ -34,8 +18,29 @@ }, "root": { "inputs": { - "mozilla-overlay": "mozilla-overlay", - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs", + "rust-overlay": "rust-overlay" + } + }, + "rust-overlay": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1719454714, + "narHash": "sha256-MojqG0lyUINkEk0b3kM2drsU5vyaF8DFZe/FAlZVOGs=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "d1c527659cf076ecc4b96a91c702d080b213801e", + "type": "github" + }, + "original": { + "owner": "oxalica", + "ref": "snapshot/2024-08-01", + "repo": "rust-overlay", + "type": "github" } } }, diff --git a/flake.nix b/flake.nix index 869822f..d43222e 100644 --- a/flake.nix +++ b/flake.nix @@ -2,30 +2,24 @@ description = "Bare-metal Rust on Zynq-7000"; 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?ref=snapshot/2024-08-01"; + inputs.nixpkgs.follows = "nixpkgs"; + }; - outputs = { self, nixpkgs, mozilla-overlay }: + outputs = { self, nixpkgs, rust-overlay }: let - pkgs = import nixpkgs { system = "x86_64-linux"; overlays = [ (import mozilla-overlay) crosspkgs-overlay ]; }; + pkgs = import nixpkgs { system = "x86_64-linux"; overlays = [ (import rust-overlay) crosspkgs-overlay ]; }; - rustManifest = pkgs.fetchurl { - url = "https://static.rust-lang.org/dist/2021-01-29/channel-rust-nightly.toml"; - sha256 = "sha256-EZKgw89AH4vxaJpUHmIMzMW/80wAFQlfcxRoBD9nz0c="; + rust = pkgs.rust-bin.nightly."2021-01-28".default.override { + extensions = [ "rust-src" ]; + targets = [ ]; }; - rustTargets = []; - 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 rustTargets; - rustPlatform = pkgs.recurseIntoAttrs (pkgs.makeRustPlatform { + rustPlatform = pkgs.makeRustPlatform { rustc = rust; cargo = rust; - }); - + }; + # https://doc.rust-lang.org/rustc/linker-plugin-lto.html#toolchain-compatibility llvmPackages_11 = pkgs.recurseIntoAttrs (pkgs.callPackage (import ./llvm/11) ({ inherit (pkgs.stdenvAdapters) overrideCC;