Use rustc and cargo from nixpkgs

This commit is contained in:
Andrey Golovizin 2023-11-20 23:02:46 +01:00
parent ecc88d172a
commit 131295fb21
3 changed files with 28 additions and 82 deletions

51
flake.lock generated
View file

@ -1,26 +1,5 @@
{ {
"nodes": { "nodes": {
"fenix": {
"inputs": {
"nixpkgs": [
"nixpkgs"
],
"rust-analyzer-src": "rust-analyzer-src"
},
"locked": {
"lastModified": 1695190922,
"narHash": "sha256-X4pQTj34pNbQK8MMIxYeuuOniNzzI5A79amorTmMloQ=",
"owner": "nix-community",
"repo": "fenix",
"rev": "a00ca48f236fc574e6932d78e27f25f21006fb1a",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "fenix",
"type": "github"
}
},
"flake-utils": { "flake-utils": {
"inputs": { "inputs": {
"systems": "systems" "systems": "systems"
@ -46,11 +25,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1694081375, "lastModified": 1698420672,
"narHash": "sha256-vzJXOUnmkMCm3xw8yfPP5m8kypQ3BhAIRe4RRCWpzy8=", "narHash": "sha256-/TdeHMPRjjdJub7p7+w55vyABrsJlt5QkznPYy55vKA=",
"owner": "nmattia", "owner": "nmattia",
"repo": "naersk", "repo": "naersk",
"rev": "3f976d822b7b37fc6fb8e6f157c2dd05e7e94e89", "rev": "aeb58d5e8faead8980a807c840232697982d47b9",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -61,11 +40,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1694959747, "lastModified": 1700390070,
"narHash": "sha256-CXQ2MuledDVlVM5dLC4pB41cFlBWxRw4tCBsFrq3cRk=", "narHash": "sha256-de9KYi8rSJpqvBfNwscWdalIJXPo8NjdIZcEJum1mH0=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "970a59bd19eff3752ce552935687100c46e820a5", "rev": "e4ad989506ec7d71f7302cc3067abd82730a4beb",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -76,29 +55,11 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"fenix": "fenix",
"flake-utils": "flake-utils", "flake-utils": "flake-utils",
"naersk": "naersk", "naersk": "naersk",
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs"
} }
}, },
"rust-analyzer-src": {
"flake": false,
"locked": {
"lastModified": 1695155769,
"narHash": "sha256-1eoWaMkGpqADYaMIabnKiMzxHNhoO1L7Z2XPHJgVn4Y=",
"owner": "rust-lang",
"repo": "rust-analyzer",
"rev": "0427a239eba36a87914dca2c7760f125b6d8fbb0",
"type": "github"
},
"original": {
"owner": "rust-lang",
"ref": "nightly",
"repo": "rust-analyzer",
"type": "github"
}
},
"systems": { "systems": {
"locked": { "locked": {
"lastModified": 1681028828, "lastModified": 1681028828,

View file

@ -3,33 +3,23 @@
inputs = { inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable"; nixpkgs.url = "nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils"; flake-utils.url = "github:numtide/flake-utils";
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
naersk = { naersk = {
url = "github:nmattia/naersk"; url = "github:nmattia/naersk";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
}; };
outputs = { self, nixpkgs, flake-utils, fenix, naersk }: outputs = { self, nixpkgs, flake-utils, naersk }:
flake-utils.lib.eachDefaultSystem ( flake-utils.lib.eachDefaultSystem (
system: let system:
let
pkgs = import nixpkgs { pkgs = import nixpkgs {
inherit system; inherit system;
}; };
rust-toolchain = fenix.packages."${system}".stable.defaultToolchain; naersk' = pkgs.callPackage naersk { };
rust-analyzer = fenix.packages."${system}".stable.rust-analyzer;
rust-src = fenix.packages."${system}".stable.rust-src;
naersk-lib = naersk.lib.${system}.override {
cargo = rust-toolchain;
rustc = rust-toolchain;
};
in in
rec { rec {
packages.azirevpn = naersk-lib.buildPackage { packages.azirevpn = naersk'.buildPackage {
pname = "azirevpn";
root = ./.; root = ./.;
}; };
packages.default = packages.azirevpn; packages.default = packages.azirevpn;
@ -40,12 +30,10 @@
devShells.default = pkgs.mkShell { devShells.default = pkgs.mkShell {
name = "azirevpn-env"; name = "azirevpn-env";
buildInputs = [ buildInputs = [
rust-analyzer pkgs.cargo
rust-toolchain pkgs.rust-analyzer
pkgs.rustc
]; ];
shellHook = ''
export RUST_SRC_PATH="${rust-src}/lib/rustlib/src/rust/library"
'';
}; };
} }
); );

View file

@ -1,3 +0,0 @@
[toolchain]
channel = "1.53.0"
components = [ "cargo", "rustfmt", "clippy", "rust-analysis", "rust-src" ]