diff --git a/flake.lock b/flake.lock index 6b93a04..b093702 100644 --- a/flake.lock +++ b/flake.lock @@ -573,6 +573,7 @@ "nixpkgs": "nixpkgs", "nixpkgs-garage": "nixpkgs-garage", "nixvim": "nixvim", + "rust-overlay": "rust-overlay_2", "sops-nix": "sops-nix", "treefmt": "treefmt" } @@ -598,6 +599,26 @@ "type": "github" } }, + "rust-overlay_2": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1737340068, + "narHash": "sha256-5UciRckNV+YOZ6y6ASBIb01cySB12whDxgFUK+EqT8g=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "275c824ed9e90e7fd4f96d187bde3670062e721f", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, "sops-nix": { "inputs": { "nixpkgs": [ diff --git a/flake.nix b/flake.nix index ce47e6b..f75fe1e 100644 --- a/flake.nix +++ b/flake.nix @@ -28,8 +28,14 @@ inputs.nixpkgs.follows = "nixpkgs"; }; flake-parts.url = "github:hercules-ci/flake-parts"; - niri.url = "github:sodiboo/niri-flake"; - niri.inputs.nixpkgs.follows = "nixpkgs"; + niri = { + url = "github:sodiboo/niri-flake"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + rust-overlay = { + url = "github:oxalica/rust-overlay"; + inputs.nixpkgs.follows = "nixpkgs"; + }; nixpkgs-garage.url = "github:cything/nixpkgs/garage-module"; # unmerged PR }; @@ -101,7 +107,10 @@ pkgs = import nixpkgs { config.allowUnfree = true; system = "x86_64-linux"; - overlays = [ inputs.niri.overlays.niri ] ++ import ./overlay; + overlays = [ + inputs.niri.overlays.niri + inputs.rust-overlay.overlays.default + ] ++ import ./overlay; }; in { diff --git a/overlay/conduwuit/default.nix b/overlay/conduwuit/default.nix index e08101c..1222c83 100644 --- a/overlay/conduwuit/default.nix +++ b/overlay/conduwuit/default.nix @@ -1,9 +1,17 @@ -final: prev: { +final: prev: +let + newRust = final.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml; + newRustPlatform = final.makeRustPlatform { + cargo = newRust; + rustc = newRust; + }; +in +{ conduwuit = prev.conduwuit.override (old: { - rustPlatform = old.rustPlatform // { + rustPlatform = newRustPlatform // { buildRustPackage = args: - old.rustPlatform.buildRustPackage ( + newRustPlatform.buildRustPackage ( args // { version = "0.5.0-rc2"; diff --git a/overlay/conduwuit/rust-toolchain.toml b/overlay/conduwuit/rust-toolchain.toml new file mode 100644 index 0000000..97e33c9 --- /dev/null +++ b/overlay/conduwuit/rust-toolchain.toml @@ -0,0 +1,28 @@ +# This is the authoritiative configuration of this project's Rust toolchain. +# +# Other files that need upkeep when this changes: +# +# * `Cargo.toml` +# * `flake.nix` +# +# Search in those files for `rust-toolchain.toml` to find the relevant places. +# If you're having trouble making the relevant changes, bug a maintainer. + +[toolchain] +channel = "1.84.0" +profile = "minimal" +components = [ + # For rust-analyzer + "rust-src", + "rust-analyzer", + # For CI and editors + "rustfmt", + "clippy", +] +targets = [ + #"x86_64-apple-darwin", + "x86_64-unknown-linux-gnu", + "x86_64-unknown-linux-musl", + "aarch64-unknown-linux-musl", + #"aarch64-apple-darwin", +]