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

This commit is contained in:
Harsh Shandilya 2023-06-25 18:29:49 +05:30
parent bf33b30f8c
commit f10e8b2906
No known key found for this signature in database
2 changed files with 48 additions and 5 deletions

24
flake.lock generated
View file

@ -43,6 +43,29 @@
"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": {
"inputs": {
"nixpkgs": [
@ -120,6 +143,7 @@
"inputs": {
"advisory-db": "advisory-db",
"crane": "crane",
"devshell": "devshell",
"fenix": "fenix",
"flake-compat": "flake-compat",
"flake-utils": "flake-utils",

View file

@ -13,6 +13,10 @@
inputs.crane.inputs.flake-utils.follows = "flake-utils";
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.inputs.nixpkgs.follows = "nixpkgs";
@ -27,12 +31,16 @@
nixpkgs,
advisory-db,
crane,
devshell,
fenix,
flake-utils,
...
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs {inherit system;};
pkgs = import nixpkgs {
inherit system;
overlays = [devshell.overlays.default];
};
rustStable = (import fenix {inherit pkgs;}).fromToolchainFile {
file = ./rust-toolchain.toml;
@ -74,16 +82,27 @@
apps.default = flake-utils.lib.mkApp {drv = clipboard-substitutor;};
devShells.default = pkgs.mkShell {
inputsFrom = builtins.attrValues self.checks;
devShells.default = pkgs.devshell.mkShell {
imports = [
"${devshell}/extra/language/c.nix"
"${devshell}/extra/language/rust.nix"
];
nativeBuildInputs = with pkgs; [
env = [
{
name = "DEVSHELL_NO_MOTD";
value = 1;
}
];
packages = with pkgs; [
cargo-nextest
cargo-release
rustStable
];
CARGO_REGISTRIES_CRATES_IO_PROTOCOL = "sparse";
language.c.libraries = commonArgs.buildInputs;
language.rust.enableDefaultToolchain = false;
};
});
}