feat(flakes): use numtide/devshell for Flake devShell

This commit is contained in:
Harsh Shandilya 2023-06-26 00:44:48 +05:30
parent d69a1ff10c
commit 39278618f1
No known key found for this signature in database
2 changed files with 47 additions and 5 deletions

24
flake.lock generated
View file

@ -43,6 +43,29 @@
"type": "github" "type": "github"
} }
}, },
"devshell": {
"inputs": {
"nixpkgs": [
"nixpkgs"
],
"systems": [
"systems"
]
},
"locked": {
"lastModified": 1687173957,
"narHash": "sha256-GOds2bAQcZ94fb9/Nl/aM+r+0wGSi4EKYuZYR8Dw4R8=",
"owner": "numtide",
"repo": "devshell",
"rev": "2cf83bb31720fcc29a999aee28d6da101173e66a",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "devshell",
"type": "github"
}
},
"fenix": { "fenix": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@ -120,6 +143,7 @@
"inputs": { "inputs": {
"advisory-db": "advisory-db", "advisory-db": "advisory-db",
"crane": "crane", "crane": "crane",
"devshell": "devshell",
"fenix": "fenix", "fenix": "fenix",
"flake-compat": "flake-compat", "flake-compat": "flake-compat",
"flake-utils": "flake-utils", "flake-utils": "flake-utils",

View file

@ -13,6 +13,10 @@
inputs.crane.inputs.flake-utils.follows = "flake-utils"; inputs.crane.inputs.flake-utils.follows = "flake-utils";
inputs.crane.inputs.nixpkgs.follows = "nixpkgs"; inputs.crane.inputs.nixpkgs.follows = "nixpkgs";
inputs.devshell.url = "github:numtide/devshell";
inputs.devshell.inputs.nixpkgs.follows = "nixpkgs";
inputs.devshell.inputs.systems.follows = "systems";
inputs.fenix.url = "github:nix-community/fenix"; inputs.fenix.url = "github:nix-community/fenix";
inputs.fenix.inputs.nixpkgs.follows = "nixpkgs"; inputs.fenix.inputs.nixpkgs.follows = "nixpkgs";
@ -27,12 +31,16 @@
nixpkgs, nixpkgs,
advisory-db, advisory-db,
crane, crane,
devshell,
fenix, fenix,
flake-utils, flake-utils,
... ...
}: }:
flake-utils.lib.eachDefaultSystem (system: let flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs {inherit system;}; pkgs = import nixpkgs {
inherit system;
overlays = [devshell.overlays.default];
};
rustNightly = (import fenix {inherit pkgs;}).fromToolchainFile { rustNightly = (import fenix {inherit pkgs;}).fromToolchainFile {
file = ./rust-toolchain.toml; file = ./rust-toolchain.toml;
@ -71,12 +79,22 @@
apps.default = flake-utils.lib.mkApp {drv = gitice;}; apps.default = flake-utils.lib.mkApp {drv = gitice;};
devShells.default = pkgs.mkShell { devShells.default = pkgs.devshell.mkShell {
inputsFrom = builtins.attrValues self.checks; bash = {interactive = "";};
nativeBuildInputs = with pkgs; [cargo-dist cargo-nextest cargo-release rustNightly]; env = [
{
name = "DEVSHELL_NO_MOTD";
value = 1;
}
];
CARGO_REGISTRIES_CRATES_IO_PROTOCOL = "sparse"; packages = with pkgs; [
cargo-dist
cargo-nextest
cargo-release
rustNightly
];
}; };
}); });
} }