From 3ea1a824ccda22165ae4d9cc51573b1056075ac5 Mon Sep 17 00:00:00 2001 From: wucke13 Date: Sun, 13 Apr 2025 13:43:59 +0200 Subject: [PATCH] feat: add rosenpass MSRV check This check requires a specific toolchain version, and to get that, we introduce oxalica's rust-overlay. Signed-off-by: wucke13 --- flake.lock | 21 +++++++++++++++++++++ flake.nix | 22 +++++++++++++++++++++- 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/flake.lock b/flake.lock index f275c35..a9dacb8 100644 --- a/flake.lock +++ b/flake.lock @@ -59,9 +59,30 @@ "flake-utils": "flake-utils", "nix-vm-test": "nix-vm-test", "nixpkgs": "nixpkgs", + "rust-overlay": "rust-overlay", "treefmt-nix": "treefmt-nix" } }, + "rust-overlay": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1744513456, + "narHash": "sha256-NLVluTmK8d01Iz+WyarQhwFcXpHEwU7m5hH3YQQFJS0=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "730fd8e82799219754418483fabe1844262fd1e2", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, "systems": { "locked": { "lastModified": 1681028828, diff --git a/flake.nix b/flake.nix index a9a3531..e54f967 100644 --- a/flake.nix +++ b/flake.nix @@ -7,6 +7,10 @@ nix-vm-test.inputs.nixpkgs.follows = "nixpkgs"; nix-vm-test.inputs.flake-utils.follows = "flake-utils"; + # for rust nightly with llvm-tools-preview + rust-overlay.url = "github:oxalica/rust-overlay"; + rust-overlay.inputs.nixpkgs.follows = "nixpkgs"; + treefmt-nix.url = "github:numtide/treefmt-nix"; treefmt-nix.inputs.nixpkgs.follows = "nixpkgs"; }; @@ -17,6 +21,7 @@ nixpkgs, flake-utils, nix-vm-test, + rust-overlay, treefmt-nix, ... }@inputs: @@ -91,10 +96,14 @@ pkgs = import nixpkgs { inherit system; - # apply our own overlay, overriding/inserting our packages as defined in ./pkgs overlays = [ + # apply our own overlay, overriding/inserting our packages as defined in ./pkgs self.overlays.default + nix-vm-test.overlays.default + + # apply rust-overlay to get specific versions of the rust toolchain for a MSRV check + (import rust-overlay) ]; }; @@ -168,6 +177,17 @@ systemd-rosenpass = pkgs.testers.runNixOSTest ./tests/systemd/rosenpass.nix; systemd-rp = pkgs.testers.runNixOSTest ./tests/systemd/rp.nix; formatting = treefmtEval.config.build.check self; + rosenpass-msrv-check = + let + rosenpassCargoToml = pkgs.lib.trivial.importTOML ./rosenpass/Cargo.toml; + + rustToolchain = pkgs.rust-bin.stable.${rosenpassCargoToml.package.rust-version}.default; + rustPlatform = pkgs.makeRustPlatform { + cargo = rustToolchain; + rustc = rustToolchain; + }; + in + pkgs.rosenpass.override { inherit rustPlatform; }; } // pkgs.lib.optionalAttrs (system == "x86_64-linux") ( import ./tests/legacy-distro-packaging.nix {