Add rustup toolchain file

This commit is contained in:
Etienne Wodey 2024-04-24 14:58:55 +02:00 committed by sb10q
parent 6212ed09ea
commit 65e280670a
3 changed files with 65 additions and 33 deletions

View File

@ -1,18 +1,20 @@
{ {
"nodes": { "nodes": {
"mozilla-overlay": { "flake-utils": {
"flake": false, "inputs": {
"systems": "systems"
},
"locked": { "locked": {
"lastModified": 1638887313, "lastModified": 1705309234,
"narHash": "sha256-FMYV6rVtvSIfthgC1sK1xugh3y7muoQcvduMdriz4ag=", "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=",
"owner": "mozilla", "owner": "numtide",
"repo": "nixpkgs-mozilla", "repo": "flake-utils",
"rev": "7c1e8b1dd6ed0043fb4ee0b12b815256b0b9de6f", "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "mozilla", "owner": "numtide",
"repo": "nixpkgs-mozilla", "repo": "flake-utils",
"type": "github" "type": "github"
} }
}, },
@ -34,11 +36,32 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"mozilla-overlay": "mozilla-overlay",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"rust-overlay": "rust-overlay",
"src-migen": "src-migen" "src-migen": "src-migen"
} }
}, },
"rust-overlay": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1713924823,
"narHash": "sha256-kOeyS3GFwgnKvzuBMmFqEAX0xwZ7Nj4/5tXuvpZ0d4U=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "8a2edac3ae926a2a6ce60f4595dcc4540fc8cad4",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
},
"src-migen": { "src-migen": {
"flake": false, "flake": false,
"locked": { "locked": {
@ -54,6 +77,21 @@
"repo": "migen", "repo": "migen",
"type": "github" "type": "github"
} }
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
} }
}, },
"root": "root", "root": "root",

View File

@ -2,16 +2,15 @@
description = "Firmware for MQTT-controlled 4-channel DDS signal generator using Urukul, Humpback and STM32 NUCLEO."; description = "Firmware for MQTT-controlled 4-channel DDS signal generator using Urukul, Humpback and STM32 NUCLEO.";
inputs.nixpkgs.url = github:NixOS/nixpkgs/nixos-21.11; inputs.nixpkgs.url = github:NixOS/nixpkgs/nixos-21.11;
inputs.mozilla-overlay = { url = github:mozilla/nixpkgs-mozilla; flake = false; }; inputs.rust-overlay.url = github:oxalica/rust-overlay;
inputs.rust-overlay.inputs.nixpkgs.follows = "nixpkgs";
inputs.src-migen = { url = github:m-labs/migen; flake = false; }; inputs.src-migen = { url = github:m-labs/migen; flake = false; };
outputs = { self, nixpkgs, mozilla-overlay, src-migen }: outputs = { self, nixpkgs, rust-overlay, src-migen }:
let let
pkgs = import nixpkgs { system = "x86_64-linux"; overlays = [ (import mozilla-overlay) ]; }; pkgs = import nixpkgs { system = "x86_64-linux"; overlays = [ (import rust-overlay) ]; };
rustManifest = pkgs.fetchurl {
url = "https://static.rust-lang.org/dist/2020-10-30/channel-rust-nightly.toml"; rustToolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
sha256 = "0iygcwzh8s0lfdghj5809krvzifc1ii1wm4sd3qqn7s0rz1s14hi";
};
migen = pkgs.python3Packages.buildPythonPackage rec { migen = pkgs.python3Packages.buildPythonPackage rec {
name = "migen"; name = "migen";
@ -19,21 +18,10 @@
propagatedBuildInputs = [ pkgs.python3Packages.colorama ]; propagatedBuildInputs = [ pkgs.python3Packages.colorama ];
}; };
targets = [ rustPlatform = pkgs.makeRustPlatform {
"thumbv7em-none-eabihf" rustc = rustToolchain;
]; cargo = rustToolchain;
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 {
rustc = rust;
cargo = rust;
});
itm = rustPlatform.buildRustPackage rec { itm = rustPlatform.buildRustPackage rec {
version = "0.3.1"; version = "0.3.1";

6
rust-toolchain.toml Normal file
View File

@ -0,0 +1,6 @@
[toolchain]
channel = "nightly-2020-10-30"
targets = [
"thumbv7em-none-eabihf",
]
profile = "minimal"