mirror of
https://github.com/numtide/treefmt.git
synced 2024-07-14 20:20:29 +03:00
feat: switch to oxalica/rust-overlay
This commit is contained in:
parent
4800bf5373
commit
e4637a77ef
2
.envrc
2
.envrc
@ -4,4 +4,4 @@ if nix flake metadata &>/dev/null; then
|
||||
use flake
|
||||
else
|
||||
use nix
|
||||
fi
|
||||
fi
|
21
default.nix
21
default.nix
@ -1,16 +1,27 @@
|
||||
{ system ? builtins.currentSystem
|
||||
, inputs ? import ./flake.lock.nix { }
|
||||
, overlays ? [ (import inputs.rust-overlay) ]
|
||||
, nixpkgs ? import inputs.nixpkgs {
|
||||
inherit system;
|
||||
inherit system overlays;
|
||||
# Makes the config pure as well. See <nixpkgs>/top-level/impure.nix:
|
||||
config = { };
|
||||
overlays = [ ];
|
||||
}
|
||||
, rustPackages ? nixpkgs.rustPackages
|
||||
, rustVersion ? nixpkgs.rust-bin.stable."1.63.0".default
|
||||
}:
|
||||
let
|
||||
lib = nixpkgs.lib;
|
||||
|
||||
rustVersionExtended = rustVersion.override {
|
||||
# include source for IDE's and other tools that resolve the source automatically via
|
||||
# $(rustc --print sysroot)/lib/rustlib/src/rust
|
||||
extensions = [ "rust-src" "rustfmt" ];
|
||||
};
|
||||
|
||||
rustPlatform = nixpkgs.makeRustPlatform {
|
||||
cargo = rustVersionExtended;
|
||||
rustc = rustVersionExtended;
|
||||
};
|
||||
|
||||
cargoToml = with builtins; (fromTOML (readFile ./Cargo.toml));
|
||||
|
||||
# Use the Nix module system to validate the treefmt config file format.
|
||||
@ -26,7 +37,7 @@ let
|
||||
};
|
||||
|
||||
# What is used when invoking `nix run github:numtide/treefmt`
|
||||
treefmt = rustPackages.rustPlatform.buildRustPackage {
|
||||
treefmt = rustPlatform.buildRustPackage {
|
||||
inherit (cargoToml.package) name version;
|
||||
|
||||
src = builtins.path {
|
||||
@ -63,7 +74,6 @@ let
|
||||
|
||||
nativeBuildInputs = prev.nativeBuildInputs ++ (with nixpkgs; [
|
||||
# Build tools
|
||||
rustPackages.clippy
|
||||
rust-analyzer
|
||||
|
||||
# Code formatters
|
||||
@ -76,7 +86,6 @@ let
|
||||
nodePackages.prettier
|
||||
python3.pkgs.black
|
||||
rufo
|
||||
rustPackages.rustfmt
|
||||
shellcheck
|
||||
shfmt
|
||||
terraform
|
||||
|
39
flake.lock
39
flake.lock
@ -20,6 +20,21 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils": {
|
||||
"locked": {
|
||||
"lastModified": 1659877975,
|
||||
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1663819708,
|
||||
@ -39,7 +54,29 @@
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-parts": "flake-parts",
|
||||
"nixpkgs": "nixpkgs"
|
||||
"nixpkgs": "nixpkgs",
|
||||
"rust-overlay": "rust-overlay"
|
||||
}
|
||||
},
|
||||
"rust-overlay": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1670552927,
|
||||
"narHash": "sha256-lCE51eAGrAFS4k9W5aDGFpVtOAwQQ/rFMN80PCDh0vo=",
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"rev": "a0fdafd18c9cf599fde17fbaf07dbb20fa57eecb",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -6,15 +6,16 @@
|
||||
inputs.flake-parts.url = "github:hercules-ci/flake-parts";
|
||||
inputs.flake-parts.inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
||||
outputs = { self, nixpkgs, flake-parts }@inputs:
|
||||
inputs.rust-overlay.url = "github:oxalica/rust-overlay";
|
||||
inputs.rust-overlay.inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
||||
outputs = { self, nixpkgs, flake-parts, rust-overlay }@inputs:
|
||||
flake-parts.lib.mkFlake { inherit self; } {
|
||||
systems = nixpkgs.lib.systems.flakeExposed;
|
||||
perSystem = { system, pkgs, ... }:
|
||||
let
|
||||
packages = import ./. {
|
||||
inherit system;
|
||||
inputs = null;
|
||||
nixpkgs = pkgs;
|
||||
};
|
||||
in
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user