Skip to content

Commit

Permalink
fix opencv not working in devshell flake
Browse files Browse the repository at this point in the history
  • Loading branch information
l1npengtul committed Nov 29, 2024
1 parent e12b54d commit 44d1fc7
Show file tree
Hide file tree
Showing 3 changed files with 150 additions and 0 deletions.
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
96 changes: 96 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

53 changes: 53 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
rust-overlay.url = "github:oxalica/rust-overlay";
};

outputs = { self, nixpkgs, rust-overlay, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs {
inherit system overlays;
};
in
{
devShells.default = pkgs.mkShell {
#LIBCLANG_PATH = "${pkgs.libclang.lib}/lib";
#BINDGEN_EXTRA_CLANG_ARGS = "-isystem ${pkgs.libclang.lib}/lib/clang/${flake-utils.lib.getVersion pkgs.clang}/include";

buildInputs = with pkgs; [
rust-bin.stable.latest.default
rust-bin.stable.latest.rustfmt
rust-bin.stable.latest.clippy
];
nativeBuildInputs = [
pkgs.pkg-config
pkgs.cmake
pkgs.vcpkg
];
packages = with pkgs; [
rust-analyzer
pkg-config
opencv
alsa-lib
systemdLibs
cmake
fontconfig
linuxHeaders
rustPlatform.bindgenHook
llvmPackages.libclang.lib
llvmPackages.clang
];
LIBCLANG_PATH = "${pkgs.llvmPackages.libclang.lib}/lib";
shellHook = ''
export LIBCLANG_PATH = "${pkgs.llvmPackages.libclang.lib}/lib";
cargo version
'';

};
}
);
}

0 comments on commit 44d1fc7

Please sign in to comment.