I am trying to create a dev shell that provides diesel-cli
. However I am getting the error Dependency is not of a valid type: element 1 of nativeBuildInputs for nix-shell
. The complete flake.nix
is below, here is a shortened version:
{
inputs = ...
outputs = {self, nixpkgs, flake-utils, rust-overlay, crane}:
flake-utils.lib.eachDefaultSystem
(system:
let
# here I am configuring diesel-cli
developmentTools = with pkgs; [diesel-cli.override {
sqliteSupport = false; mysqlSupport = false;
}];
in
with pkgs;
{
devShells.default = mkShell {
# this should add diesel-cli to the shell
packages = developmentTools;
};
}
);
}
flake.nix
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs = {
nixpkgs.follows = "nixpkgs";
flake-utils.follows = "flake-utils";
};
};
crane = {
url = "github:ipetkov/crane";
inputs = {
nixpkgs.follows = "nixpkgs";
rust-overlay.follows = "rust-overlay";
flake-utils.follows = "flake-utils";
};
};
};
outputs = {self, nixpkgs, flake-utils, rust-overlay, crane}:
flake-utils.lib.eachDefaultSystem
(system:
let
overlays = [(import rust-overlay)];
pkgs = import nixpkgs {
inherit system overlays;
};
rustToolchain = pkgs.pkgsBuildHost.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
craneLib = (crane.mkLib pkgs).overrideToolchain rustToolchain;
src = craneLib.cleanCargoSource ./.;
nativeBuildInputs = with pkgs; [rustToolchain pkg-config];
buildInputs = with pkgs; [rustToolchain openssl];
# here I am configuring diesel-cli
developmentTools = with pkgs; [diesel-cli.override {sqliteSupport = false; mysqlSupport = false;}];
commonArgs = {
inherit src buildInputs nativeBuildInputs;
};
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
bin = craneLib.buildPackage(commonArgs // {inherit cargoArtifacts;});
dockerImage = pkgs.dockerTools.streamLayeredImage {
name = "rvoc-backend";
tag = "latest";
contents = [bin pkgs.cacert];
config = {
Cmd = ["${bin}/bin/rvoc-backend"];
};
};
in
with pkgs;
{
packages = {
inherit bin dockerImage;
default = bin;
};
devShells.default = mkShell {
inputsFrom = [bin];
buildInputs = with pkgs; [dive];
# this should add diesel-cli to the shell
packages = developmentTools;
};
}
);
}
How do I get this to build, such that the command diesel
that is provided by diesel-cli
will be available in the dev shell?