Skip to content

Commit

Permalink
add nix flake
Browse files Browse the repository at this point in the history
  • Loading branch information
maximbaz committed Jul 18, 2024
1 parent f7aa996 commit 7ec5114
Show file tree
Hide file tree
Showing 3 changed files with 140 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
93 changes: 93 additions & 0 deletions flake.lock

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

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

outputs = { self, nixpkgs, flake-utils, naersk }:
let systems = [ "x86_64-linux" "aarch64-linux" ];
in flake-utils.lib.eachSystem systems (system:
let
pkgs = import nixpkgs { inherit system; };
naersk-lib = pkgs.callPackage naersk { };
libs = with pkgs; [
udev
v4l-utils
vulkan-loader
dbus
];
in
{
defaultPackage = naersk-lib.buildPackage {
src = ./.;
meta.mainProgram = "wluma";
nativeBuildInputs = with pkgs; [
makeWrapper
pkg-config
rustPlatform.bindgenHook
marked-man
];
buildInputs = libs;
};
devShell = with pkgs; mkShell {
buildInputs = [ cargo rustc rustfmt pre-commit rustPackages.clippy pkg-config ] ++ libs;
RUST_SRC_PATH = rustPlatform.rustLibSrc;
LIBCLANG_PATH = "${llvmPackages_12.libclang.lib}/lib";
BINDGEN_EXTRA_CLANG_ARGS = [
''-I"${llvmPackages_12.libclang.lib}/lib/clang/${llvmPackages_12.libclang.version}/include"''
] ++ (builtins.map (a: ''-I"${a}/include"'') [
glibc.dev
libv4l.dev
]);
};
}
);
}

0 comments on commit 7ec5114

Please sign in to comment.