Skip to content

Instantly share code, notes, and snippets.

@tomasol
Created January 12, 2024 10:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomasol/1b25d03709cefd6a3c62338caa2fe234 to your computer and use it in GitHub Desktop.
Save tomasol/1b25d03709cefd6a3c62338caa2fe234 to your computer and use it in GitHub Desktop.
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs = {
nixpkgs.follows = "nixpkgs";
flake-utils.follows = "flake-utils";
};
};
};
outputs = { self, nixpkgs, flake-utils, rust-overlay }:
flake-utils.lib.eachDefaultSystem
(system:
let
overlays = [ (import rust-overlay) (final: prev: {
rust-analyzer-unwrapped = prev.rust-analyzer-unwrapped.overrideAttrs (old: rec {
src = prev.fetchFromGitHub {
owner = "tomasol";
repo = "rust-analyzer";
rev = "ab849d87a1ef4a48a5ad121f1059a0b7a15af485";
sha256 = "sha256-KhukRUCbveChS1SNRs3N+DGOchTv+Ch+eVlxbJIc/rw=";
};
cargoDeps = old.cargoDeps.overrideAttrs (pkgs.lib.const {
name = "rust-analyzer-unwrapped-vendor.tar.gz";
inherit src;
outputHash = "sha256-ItyXdLHrpgEMz1BHQk49w37D8Y15L7vg0jyWurrIZLs=";
});
});
cargo-component = prev.cargo-component.overrideAttrs (old: rec {
version = "0.5.0";
src = prev.fetchFromGitHub {
owner = "bytecodealliance";
repo = "cargo-component";
rev = "v0.5.0";
sha256 = "sha256-P7gXfACPK63f38KzV6UVQa8MZmxEaMNxl1GZYCDM54M=";
};
cargoDeps = old.cargoDeps.overrideAttrs (pkgs.lib.const {
inherit src;
outputHash = "sha256-JEkupF7RhHqnxbA3DdJKGGznTzoAsPIcvYGjOfqdP4M=";
});
});
})
];
pkgs = import nixpkgs {
inherit system overlays;
};
rustToolchain = pkgs.pkgsBuildHost.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
in
{
devShells.default = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
cargo-component
cargo-expand
cargo-nextest
nixpkgs-fmt
pkg-config
rust-analyzer-unwrapped
rustToolchain
wasm-tools
];
};
}
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment