diff --git a/compiler-cli/src/panic.rs b/compiler-cli/src/panic.rs index 099b6a704..69caf1692 100644 --- a/compiler-cli/src/panic.rs +++ b/compiler-cli/src/panic.rs @@ -1,13 +1,13 @@ #![allow(clippy::unwrap_used)] -use std::panic::PanicInfo; +use std::panic::PanicHookInfo; pub fn add_handler() { - std::panic::set_hook(Box::new(move |info: &PanicInfo<'_>| { + std::panic::set_hook(Box::new(move |info: &PanicHookInfo<'_>| { print_compiler_bug_message(info) })); } -fn print_compiler_bug_message(info: &PanicInfo<'_>) { +fn print_compiler_bug_message(info: &PanicHookInfo<'_>) { let message = match ( info.payload().downcast_ref::<&str>(), info.payload().downcast_ref::(), diff --git a/flake.lock b/flake.lock index 68661d933..df24f4c08 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,26 @@ { "nodes": { + "fenix": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ], + "rust-analyzer-src": "rust-analyzer-src" + }, + "locked": { + "lastModified": 1730097176, + "narHash": "sha256-ufvRff76Y19mkRsmx+mAnxKE9A9VaNWC2mVY6TwumOw=", + "owner": "nix-community", + "repo": "fenix", + "rev": "482b57f3f27a9336e0fbc62fa99ee0f624ccf4d0", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "fenix", + "type": "github" + } + }, "flake-parts": { "inputs": { "nixpkgs-lib": "nixpkgs-lib" @@ -47,11 +68,42 @@ }, "root": { "inputs": { + "fenix": "fenix", "flake-parts": "flake-parts", "nixpkgs": "nixpkgs", + "rust-manifest": "rust-manifest", "systems": "systems" } }, + "rust-analyzer-src": { + "flake": false, + "locked": { + "lastModified": 1730028316, + "narHash": "sha256-FsPsSjqnqMHBgDdM24DFLw4YOw0mFKYFJBcLaI6CvI8=", + "owner": "rust-lang", + "repo": "rust-analyzer", + "rev": "3b3a87fe9bd3f2a79942babc1d1e385b6805c384", + "type": "github" + }, + "original": { + "owner": "rust-lang", + "ref": "nightly", + "repo": "rust-analyzer", + "type": "github" + } + }, + "rust-manifest": { + "flake": false, + "locked": { + "narHash": "sha256-tB9BZB6nRHDk5ELIVlGYlIjViLKBjQl52nC1avhcCwA=", + "type": "file", + "url": "https://static.rust-lang.org/dist/channel-rust-1.81.0.toml" + }, + "original": { + "type": "file", + "url": "https://static.rust-lang.org/dist/channel-rust-1.81.0.toml" + } + }, "systems": { "locked": { "lastModified": 1681028828, diff --git a/flake.nix b/flake.nix index 5ff2397ba..dcb900ff6 100644 --- a/flake.nix +++ b/flake.nix @@ -2,9 +2,17 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; systems.url = "github:nix-systems/default"; + fenix = { + url = "github:nix-community/fenix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + rust-manifest = { + url = "https://static.rust-lang.org/dist/channel-rust-1.81.0.toml"; + flake = false; + }; }; - outputs = inputs@{ nixpkgs, flake-parts, systems, ... }: + outputs = inputs@{ nixpkgs, flake-parts, systems, fenix, rust-manifest, ... }: let expressions = import ./nix; in @@ -20,9 +28,16 @@ ./nix/flake-builders.nix ]; - perSystem = { self', pkgs, lib, ... }: + perSystem = { self', pkgs, lib, system, ... }: let - glistix = pkgs.callPackage expressions.glistix { }; + rust-toolchain = (fenix.packages.${system}.fromManifestFile rust-manifest).defaultToolchain; + + rustPlatform = pkgs.makeRustPlatform { + cargo = rust-toolchain; + rustc = rust-toolchain; + }; + + glistix = pkgs.callPackage expressions.glistix { inherit rustPlatform; }; in { formatter = pkgs.nixpkgs-fmt;