mirror of
https://github.com/RGBCube/alejandra
synced 2025-08-01 04:57:44 +00:00
feat: use nighly toolchain
This commit is contained in:
parent
4833d71826
commit
ba47c3b118
3 changed files with 27 additions and 55 deletions
17
flake.lock
generated
17
flake.lock
generated
|
@ -2,7 +2,9 @@
|
||||||
"nodes": {
|
"nodes": {
|
||||||
"fenix": {
|
"fenix": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": "nixpkgs",
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
],
|
||||||
"rust-analyzer-src": "rust-analyzer-src"
|
"rust-analyzer-src": "rust-analyzer-src"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
|
@ -52,16 +54,16 @@
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1643347846,
|
"lastModified": 1643322911,
|
||||||
"narHash": "sha256-O0tyXF//ppRpe9yT1Uu5n34yI2MWDyY6ZiJ4Qn5zIkE=",
|
"narHash": "sha256-WLe4lXAYXH/v80iO02npX1wdXq4nIVEHJTONLXbQrL0=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "5bb20f9dc70e9ee16e21cc404b6508654931ce41",
|
"rev": "d9e21f284317f85b3476c0043f4efea87a226c3a",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"ref": "nixos-unstable",
|
"ref": "nixpkgs-unstable",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
|
@ -71,10 +73,7 @@
|
||||||
"fenix": "fenix",
|
"fenix": "fenix",
|
||||||
"flakeCompat": "flakeCompat",
|
"flakeCompat": "flakeCompat",
|
||||||
"flakeUtils": "flakeUtils",
|
"flakeUtils": "flakeUtils",
|
||||||
"nixpkgs": [
|
"nixpkgs": "nixpkgs"
|
||||||
"fenix",
|
|
||||||
"nixpkgs"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"rust-analyzer-src": {
|
"rust-analyzer-src": {
|
||||||
|
|
60
flake.nix
60
flake.nix
|
@ -1,11 +1,11 @@
|
||||||
{
|
{
|
||||||
inputs = {
|
inputs = {
|
||||||
|
fenix.url = "github:nix-community/fenix";
|
||||||
|
fenix.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
flakeCompat.url = github:edolstra/flake-compat;
|
flakeCompat.url = github:edolstra/flake-compat;
|
||||||
flakeCompat.flake = false;
|
flakeCompat.flake = false;
|
||||||
flakeUtils.url = "github:numtide/flake-utils";
|
flakeUtils.url = "github:numtide/flake-utils";
|
||||||
nixpkgs.follows = "fenix/nixpkgs";
|
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
||||||
# add https://app.cachix.org/cache/nix-community to your `nix.conf`
|
|
||||||
fenix.url = "github:nix-community/fenix";
|
|
||||||
};
|
};
|
||||||
outputs =
|
outputs =
|
||||||
inputs:
|
inputs:
|
||||||
|
@ -13,20 +13,19 @@
|
||||||
(
|
(
|
||||||
system:
|
system:
|
||||||
let
|
let
|
||||||
toolchain = "stable";
|
|
||||||
nixpkgs = import inputs.nixpkgs { inherit system; };
|
nixpkgs = import inputs.nixpkgs { inherit system; };
|
||||||
cargoToml = builtins.fromTOML ( builtins.readFile ./Cargo.toml );
|
cargoToml = builtins.fromTOML ( builtins.readFile ./Cargo.toml );
|
||||||
|
fenix = inputs.fenix.packages.${ system };
|
||||||
|
fenixPlatform = nixpkgs.makeRustPlatform { inherit ( fenix.latest ) cargo rustc; };
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
checks = {
|
checks = { defaultPackage = inputs.self.defaultPackage.${ system }; };
|
||||||
defaultPackage = inputs.self.defaultPackage.${ system };
|
defaultApp = {
|
||||||
inherit ( inputs.self.packages.${ system } ) nixpkgsFormatted;
|
type = "app";
|
||||||
|
program = "${ inputs.self.defaultPackage.${ system } }/bin/alejandra";
|
||||||
};
|
};
|
||||||
defaultApp = { type = "app"; program = "${ inputs.self.defaultPackage.${ system } }/bin/alejandra"; };
|
|
||||||
defaultPackage =
|
defaultPackage =
|
||||||
(nixpkgs.makeRustPlatform {
|
fenixPlatform.buildRustPackage
|
||||||
inherit (inputs.fenix.packages.${ system }.${ toolchain }) cargo rustc;
|
|
||||||
}).buildRustPackage
|
|
||||||
{
|
{
|
||||||
pname = cargoToml.package.name;
|
pname = cargoToml.package.name;
|
||||||
version =
|
version =
|
||||||
|
@ -37,7 +36,6 @@
|
||||||
"${ builtins.substring 0 8 date }_${ commit }";
|
"${ builtins.substring 0 8 date }_${ commit }";
|
||||||
src = inputs.self.sourceInfo;
|
src = inputs.self.sourceInfo;
|
||||||
cargoLock.lockFile = ./Cargo.lock;
|
cargoLock.lockFile = ./Cargo.lock;
|
||||||
NIX_BUILD_CORES = 0;
|
|
||||||
meta = {
|
meta = {
|
||||||
description = cargoToml.package.description;
|
description = cargoToml.package.description;
|
||||||
homepage = "https://github.com/kamadorueda/alejandra";
|
homepage = "https://github.com/kamadorueda/alejandra";
|
||||||
|
@ -49,40 +47,14 @@
|
||||||
nixpkgs.mkShell
|
nixpkgs.mkShell
|
||||||
{
|
{
|
||||||
packages = [
|
packages = [
|
||||||
inputs.fenix.packages.${ system }.rust-analyzer
|
fenix.rust-analyzer
|
||||||
(inputs.fenix.packages.${ system }.${ toolchain }.withComponents [
|
fenix.latest.cargo
|
||||||
"cargo"
|
fenix.latest.clippy
|
||||||
"clippy"
|
fenix.latest.rust-src
|
||||||
"rust-src"
|
fenix.latest.rustc
|
||||||
"rustc"
|
fenix.latest.rustfmt
|
||||||
"rustfmt"
|
|
||||||
])
|
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
packages = {
|
|
||||||
nixpkgsFormatted =
|
|
||||||
nixpkgs.stdenv.mkDerivation
|
|
||||||
{
|
|
||||||
name = "nixpkgs-formatted";
|
|
||||||
builder =
|
|
||||||
builtins.toFile
|
|
||||||
"builder.sh"
|
|
||||||
''
|
|
||||||
source $stdenv/setup
|
|
||||||
|
|
||||||
cp -rT $nixpkgs $out
|
|
||||||
chmod -R +w $out
|
|
||||||
|
|
||||||
alejandra $out
|
|
||||||
|
|
||||||
git diff --no-index $nixpkgs $out > $diff || true
|
|
||||||
'';
|
|
||||||
buildInputs = [ inputs.self.defaultPackage.${ system } nixpkgs.git ];
|
|
||||||
nixpkgs = inputs.nixpkgs.sourceInfo.outPath;
|
|
||||||
NIX_BUILD_CORES = 0;
|
|
||||||
outputs = [ "diff" "out" ];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -173,7 +173,7 @@ fn format(
|
||||||
rnix::SyntaxKind::NODE_ATTR_SET => crate::rules::attr_set::rule,
|
rnix::SyntaxKind::NODE_ATTR_SET => crate::rules::attr_set::rule,
|
||||||
// a $op b
|
// a $op b
|
||||||
rnix::SyntaxKind::NODE_BIN_OP => crate::rules::bin_op::rule,
|
rnix::SyntaxKind::NODE_BIN_OP => crate::rules::bin_op::rule,
|
||||||
//
|
// ${a} (interpolation but for NODE_SELECT)
|
||||||
rnix::SyntaxKind::NODE_DYNAMIC => crate::rules::dynamic::rule,
|
rnix::SyntaxKind::NODE_DYNAMIC => crate::rules::dynamic::rule,
|
||||||
// implementation detail of rnix-parser
|
// implementation detail of rnix-parser
|
||||||
rnix::SyntaxKind::NODE_ERROR => {
|
rnix::SyntaxKind::NODE_ERROR => {
|
||||||
|
@ -201,7 +201,7 @@ fn format(
|
||||||
rnix::SyntaxKind::NODE_LET_IN => crate::rules::let_in::rule,
|
rnix::SyntaxKind::NODE_LET_IN => crate::rules::let_in::rule,
|
||||||
// [ ... ]
|
// [ ... ]
|
||||||
rnix::SyntaxKind::NODE_LIST => crate::rules::list::rule,
|
rnix::SyntaxKind::NODE_LIST => crate::rules::list::rule,
|
||||||
// $literal
|
// 1 | true | null
|
||||||
rnix::SyntaxKind::NODE_LITERAL => crate::rules::default,
|
rnix::SyntaxKind::NODE_LITERAL => crate::rules::default,
|
||||||
// let { }
|
// let { }
|
||||||
rnix::SyntaxKind::NODE_LEGACY_LET => {
|
rnix::SyntaxKind::NODE_LEGACY_LET => {
|
||||||
|
@ -231,6 +231,7 @@ fn format(
|
||||||
}
|
}
|
||||||
// implementation detail of rowan
|
// implementation detail of rowan
|
||||||
rnix::SyntaxKind::NODE_ROOT => crate::rules::root::rule,
|
rnix::SyntaxKind::NODE_ROOT => crate::rules::root::rule,
|
||||||
|
// a.b | a.NODE_DYNAMIC
|
||||||
rnix::SyntaxKind::NODE_SELECT => crate::rules::select::rule,
|
rnix::SyntaxKind::NODE_SELECT => crate::rules::select::rule,
|
||||||
// "..." || ''...''
|
// "..." || ''...''
|
||||||
rnix::SyntaxKind::NODE_STRING => crate::rules::string::rule,
|
rnix::SyntaxKind::NODE_STRING => crate::rules::string::rule,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue