rand_testsuite/flake.nix

91 lines
2.5 KiB
Nix
Raw Normal View History

2024-09-05 13:45:23 +00:00
{
2024-09-06 08:20:10 +00:00
description = "rand-testsuite";
2024-09-05 13:45:23 +00:00
inputs = {
nixpkgs.url = github:NixOS/nixpkgs;
flake-utils.url = github:numtide/flake-utils;
rust-overlay = {
url = github:oxalica/rust-overlay;
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
};
cargo2nix = {
2024-09-08 16:54:42 +00:00
url = github:DarkKirb/cargo2nix/master;
2024-09-05 13:45:23 +00:00
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
inputs.rust-overlay.follows = "rust-overlay";
};
flake-compat.url = "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz";
};
outputs = {
self,
nixpkgs,
flake-utils,
rust-overlay,
cargo2nix,
...
} @ inputs:
flake-utils.lib.eachSystem ["x86_64-linux"] (system: let
overlays = [
cargo2nix.overlays.default
(import rust-overlay)
];
pkgs = import nixpkgs {
inherit system overlays;
};
2024-09-08 16:54:42 +00:00
registryDownloadPaths = {
"sparse+https://git.chir.rs/api/packages/ProcyOS/cargo/" = "https://git.chir.rs/api/packages/ProcyOS/cargo/api/v1/crates";
};
2024-09-05 13:45:23 +00:00
rustPkgs = pkgs.rustBuilder.makePackageSet {
packageFun = import ./Cargo.nix;
rustChannel = "nightly";
rustVersion = "latest";
packageOverrides = pkgs: pkgs.rustBuilder.overrides.all;
2024-09-06 08:20:10 +00:00
rootFeatures = [
"rand_testsuite/default"
"rand_testsuite/full"
];
2024-09-08 16:54:42 +00:00
fetchCrateAlternativeRegistry = {
index,
name,
version,
sha256,
}:
pkgs.fetchurl {
name = "${name}-${version}.tar.gz";
url = "${registryDownloadPaths.${index}}/${name}/${version}/download";
inherit sha256;
};
2024-09-05 13:45:23 +00:00
};
in rec {
devShells.default = with pkgs;
mkShell {
buildInputs = [
(rust-bin.nightly.latest.default.override {
extensions = ["rust-src"];
})
cargo2nix.packages.${system}.cargo2nix
llvmPackages_19.bintools
rustfilt
openssl
pkg-config
gdb
];
};
packages = pkgs.lib.mapAttrs (_: v: v {}) rustPkgs.workspace;
nixosModules.default = import ./nixos {
inherit inputs system;
};
checks = pkgs.lib.mapAttrs (_: v: pkgs.rustBuilder.runTests v {}) rustPkgs.workspace;
hydraJobs = {
inherit packages checks;
};
formatter = pkgs.alejandra;
});
}
# Trick renovate into working: "github:NixOS/nixpkgs/nixpkgs-unstable"