mirror of
https://github.com/numtide/treefmt.git
synced 2024-08-16 20:30:25 +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
|
use flake
|
||||||
else
|
else
|
||||||
use nix
|
use nix
|
||||||
fi
|
fi
|
21
default.nix
21
default.nix
@ -1,16 +1,27 @@
|
|||||||
{ system ? builtins.currentSystem
|
{ system ? builtins.currentSystem
|
||||||
, inputs ? import ./flake.lock.nix { }
|
, inputs ? import ./flake.lock.nix { }
|
||||||
|
, overlays ? [ (import inputs.rust-overlay) ]
|
||||||
, nixpkgs ? import inputs.nixpkgs {
|
, nixpkgs ? import inputs.nixpkgs {
|
||||||
inherit system;
|
inherit system overlays;
|
||||||
# Makes the config pure as well. See <nixpkgs>/top-level/impure.nix:
|
# Makes the config pure as well. See <nixpkgs>/top-level/impure.nix:
|
||||||
config = { };
|
config = { };
|
||||||
overlays = [ ];
|
|
||||||
}
|
}
|
||||||
, rustPackages ? nixpkgs.rustPackages
|
, rustVersion ? nixpkgs.rust-bin.stable."1.63.0".default
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
lib = nixpkgs.lib;
|
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));
|
cargoToml = with builtins; (fromTOML (readFile ./Cargo.toml));
|
||||||
|
|
||||||
# Use the Nix module system to validate the treefmt config file format.
|
# 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`
|
# What is used when invoking `nix run github:numtide/treefmt`
|
||||||
treefmt = rustPackages.rustPlatform.buildRustPackage {
|
treefmt = rustPlatform.buildRustPackage {
|
||||||
inherit (cargoToml.package) name version;
|
inherit (cargoToml.package) name version;
|
||||||
|
|
||||||
src = builtins.path {
|
src = builtins.path {
|
||||||
@ -63,7 +74,6 @@ let
|
|||||||
|
|
||||||
nativeBuildInputs = prev.nativeBuildInputs ++ (with nixpkgs; [
|
nativeBuildInputs = prev.nativeBuildInputs ++ (with nixpkgs; [
|
||||||
# Build tools
|
# Build tools
|
||||||
rustPackages.clippy
|
|
||||||
rust-analyzer
|
rust-analyzer
|
||||||
|
|
||||||
# Code formatters
|
# Code formatters
|
||||||
@ -76,7 +86,6 @@ let
|
|||||||
nodePackages.prettier
|
nodePackages.prettier
|
||||||
python3.pkgs.black
|
python3.pkgs.black
|
||||||
rufo
|
rufo
|
||||||
rustPackages.rustfmt
|
|
||||||
shellcheck
|
shellcheck
|
||||||
shfmt
|
shfmt
|
||||||
terraform
|
terraform
|
||||||
|
39
flake.lock
39
flake.lock
@ -20,6 +20,21 @@
|
|||||||
"type": "github"
|
"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": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1663819708,
|
"lastModified": 1663819708,
|
||||||
@ -39,7 +54,29 @@
|
|||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-parts": "flake-parts",
|
"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.url = "github:hercules-ci/flake-parts";
|
||||||
inputs.flake-parts.inputs.nixpkgs.follows = "nixpkgs";
|
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; } {
|
flake-parts.lib.mkFlake { inherit self; } {
|
||||||
systems = nixpkgs.lib.systems.flakeExposed;
|
systems = nixpkgs.lib.systems.flakeExposed;
|
||||||
perSystem = { system, pkgs, ... }:
|
perSystem = { system, pkgs, ... }:
|
||||||
let
|
let
|
||||||
packages = import ./. {
|
packages = import ./. {
|
||||||
inherit system;
|
inherit system;
|
||||||
inputs = null;
|
|
||||||
nixpkgs = pkgs;
|
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user