Hey folks,
I’ve been building my recent Rust project in Nix devshells, and the one bit about the process I didn’t like was manually pulling in third-party unpackaged Cargo binaries via cargo install
. I tried automating that using the below devshell, but it doesn’t seem to work. Specifically:
- I’d expect a
dx
command in my path but I don’t have one. - If I do
nix build .#dioxus-cli
I get an empty resultbin directory and nothing else.
Is there anything obviously wrong with this flake definition? I set things up so nix build .#dioxus-cli
works but that’s only for testing–eventually I want to remove that once things are working.
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
nixpkgsUnstable.url = "github:NixOS/nixpkgs/nixos-unstable";
utils.url = "github:numtide/flake-utils";
naersk.url = "github:nix-community/naersk/master";
};
outputs =
{
self,
nixpkgs,
nixpkgsUnstable,
utils,
naersk,
}:
utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs { inherit system; };
pkgsUnstable = import nixpkgsUnstable { inherit system; };
naersk' = pkgs.callPackage naersk { };
dioxus-cli = naersk'.buildPackage {
name = "dioxus-cli";
src = pkgs.fetchFromGitHub {
owner = "dioxuslabs";
repo = "dioxus";
rev = "v0.6.3";
hash = "sha256-iA9GDN1hE6KuKINizHZGhXADVZ6xYxl4bbEGqSsl42g=";
};
};
in
{
packages.dioxus-cli = dioxus-cli;
devShell =
with pkgs;
mkShell.override { stdenv = pkgs.clangStdenv; } {
nativeBuildInputs = [
cargo
rustc
rustfmt
rustPackages.clippy
cargo-watch
dioxus-cli
llvmPackages.bintools
pkg-config
pkgsUnstable.overturemaps
duckdb
pre-commit
overmind
redis
minio
];
buildInputs = [
webkitgtk_4_1
gtk3
xdotool.out
openssl
];
shellHook = ''
# pre-commit install
'';
RUST_SRC_PATH = rustPlatform.rustLibSrc;
};
}
);
}
Thanks.