1
Fork 0
mirror of https://github.com/RGBCube/alejandra synced 2025-08-01 04:57:44 +00:00

fix: devshell cargo version

fixes: #4
This commit is contained in:
David Arnold 2022-01-29 19:16:43 -05:00
parent 870af566c7
commit 0838e5a2b5
No known key found for this signature in database
GPG key ID: 0318D822BAC965CC
2 changed files with 62 additions and 12 deletions

50
flake.lock generated
View file

@ -1,5 +1,24 @@
{ {
"nodes": { "nodes": {
"fenix": {
"inputs": {
"nixpkgs": "nixpkgs",
"rust-analyzer-src": "rust-analyzer-src"
},
"locked": {
"lastModified": 1643437378,
"narHash": "sha256-nciShE41PZ5wU54Sm7xSLsZxzgcSlab2UNrf5GGjndc=",
"owner": "nix-community",
"repo": "fenix",
"rev": "af56bbdd36b7644ea466cef5a4b1163d923296a7",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "fenix",
"type": "github"
}
},
"flakeCompat": { "flakeCompat": {
"flake": false, "flake": false,
"locked": { "locked": {
@ -33,25 +52,46 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1643119265, "lastModified": 1643347846,
"narHash": "sha256-mmDEctIkHSWcC/HRpeaw6QOe+DbNOSzc0wsXAHOZWwo=", "narHash": "sha256-O0tyXF//ppRpe9yT1Uu5n34yI2MWDyY6ZiJ4Qn5zIkE=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "b05d2077ebe219f6a47825767f8bab5c6211d200", "rev": "5bb20f9dc70e9ee16e21cc404b6508654931ce41",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "nixos", "owner": "nixos",
"ref": "nixpkgs-unstable", "ref": "nixos-unstable",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }
}, },
"root": { "root": {
"inputs": { "inputs": {
"fenix": "fenix",
"flakeCompat": "flakeCompat", "flakeCompat": "flakeCompat",
"flakeUtils": "flakeUtils", "flakeUtils": "flakeUtils",
"nixpkgs": "nixpkgs" "nixpkgs": [
"fenix",
"nixpkgs"
]
}
},
"rust-analyzer-src": {
"flake": false,
"locked": {
"lastModified": 1643383912,
"narHash": "sha256-QtpTMM54jozLsjpOt3tMvnAoL+nc5bezbwxilHooOzM=",
"owner": "rust-analyzer",
"repo": "rust-analyzer",
"rev": "6634eaf13a7e3a2b30f98f6e69af952f2d760df4",
"type": "github"
},
"original": {
"owner": "rust-analyzer",
"ref": "nightly",
"repo": "rust-analyzer",
"type": "github"
} }
} }
}, },

View file

@ -3,7 +3,9 @@
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.url = "github:nixos/nixpkgs/nixpkgs-unstable"; nixpkgs.follows = "fenix/nixpkgs";
# add https://app.cachix.org/cache/nix-community to your `nix.conf`
fenix.url = "github:nix-community/fenix";
}; };
outputs = outputs =
inputs: inputs:
@ -11,6 +13,7 @@
( (
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 );
in in
@ -21,7 +24,9 @@
}; };
defaultApp = { type = "app"; program = "${ inputs.self.defaultPackage.${ system } }/bin/alejandra"; }; defaultApp = { type = "app"; program = "${ inputs.self.defaultPackage.${ system } }/bin/alejandra"; };
defaultPackage = defaultPackage =
nixpkgs.rustPlatform.buildRustPackage (nixpkgs.makeRustPlatform {
inherit (inputs.fenix.packages.${ system }.${ toolchain }) cargo rustc;
}).buildRustPackage
{ {
pname = cargoToml.package.name; pname = cargoToml.package.name;
version = version =
@ -43,11 +48,16 @@
devShell = devShell =
nixpkgs.mkShell nixpkgs.mkShell
{ {
packages = [ nixpkgs.cargo-tarpaulin nixpkgs.rustup ]; packages = [
shellHook = inputs.fenix.packages.${ system }.rust-analyzer
'' (inputs.fenix.packages.${ system }.${ toolchain }.withComponents [
rustup toolchain install nightly "cargo"
''; "clippy"
"rust-src"
"rustc"
"rustfmt"
])
];
}; };
packages = { packages = {
nixpkgsFormatted = nixpkgsFormatted =