feat: switch to rust-overlay

This commit is contained in:
uku 2024-07-27 19:42:35 +02:00
parent 7c14a2bd00
commit 3e0b846a3a
Signed by: uku
SSH key fingerprint: SHA256:4P0aN6M8ajKukNi6aPOaX0LacanGYtlfjmN+m/sHY/o
2 changed files with 48 additions and 7 deletions

View file

@ -39,7 +39,28 @@
"root": { "root": {
"inputs": { "inputs": {
"flake-parts": "flake-parts", "flake-parts": "flake-parts",
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs",
"rust-overlay": "rust-overlay"
}
},
"rust-overlay": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1722046723,
"narHash": "sha256-G7/gHz8ORRvHd1/RIURrdcswKRPe9K0FsIYR4v5jSWo=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "56baac5e6b2743d4730e664ea64f6d8a2aad0fbb",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
} }
} }
}, },

View file

@ -6,11 +6,18 @@
url = "github:hercules-ci/flake-parts"; url = "github:hercules-ci/flake-parts";
inputs.nixpkgs-lib.follows = "nixpkgs"; inputs.nixpkgs-lib.follows = "nixpkgs";
}; };
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
}; };
outputs = { outputs = {
self, self,
nixpkgs,
flake-parts, flake-parts,
rust-overlay,
... ...
} @ inputs: } @ inputs:
flake-parts.lib.mkFlake {inherit inputs;} { flake-parts.lib.mkFlake {inherit inputs;} {
@ -18,17 +25,30 @@
perSystem = { perSystem = {
lib, lib,
pkgs, system,
self', self',
... ...
}: { }: let
packages.default = pkgs.callPackage ./derivation.nix {inherit self;}; pkgs = import nixpkgs {
inherit system;
overlays = [(import rust-overlay)];
};
toolchain = pkgs.rust-bin.stable.latest.default;
rustPlatform = pkgs.makeRustPlatform {
rustc = toolchain;
cargo = toolchain;
};
in {
packages.default = pkgs.callPackage ./derivation.nix {inherit self rustPlatform;};
devShells.default = with pkgs; devShells.default = with pkgs;
mkShell { mkShell {
packages = [clippy rustfmt rust-analyzer]; buildInputs = [
inputsFrom = [self'.packages.default]; (toolchain.override {
RUST_SRC_PATH = "${pkgs.rustPlatform.rustLibSrc}"; extensions = ["rust-analyzer" "rust-src"];
})
];
}; };
formatter = pkgs.alejandra; formatter = pkgs.alejandra;