unbound-rust-mod/flake.nix

36 lines
1.2 KiB
Nix
Raw Normal View History

2024-08-09 15:27:40 +07:00
{
description = "A very basic flake";
inputs = {
nixpkgs.url = "github:chayleaf/nixpkgs/unbound";
};
outputs = { self, nixpkgs }: {
packages.x86_64-linux.bindings = let
pkgs = import nixpkgs { system = "x86_64-linux"; };
in pkgs.unbound-full.overrideAttrs (old: {
name = "unbound-dynmod-bindings.rs";
nativeBuildInputs = old.nativeBuildInputs ++ [ pkgs.rust-bindgen pkgs.rustfmt ];
phases = ["unpackPhase" "patchPhase" "configurePhase" "installPhase"];
outputs = [ "out" ];
installPhase = ''
cp ${./dummy.h} ./dummy.h
bindgen ./dummy.h -- -I $PWD > $out
'';
});
devShells.x86_64-linux.default = let
pkgs = import nixpkgs { system = "x86_64-linux"; };
2024-08-10 07:37:04 +07:00
in pkgs.mkShell rec {
2024-08-09 15:27:40 +07:00
name = "unbound-rust-mod-shell";
2024-08-11 01:29:09 +07:00
nativeBuildInputs = [ pkgs.rustc pkgs.cargo pkgs.nftables ];
2024-08-09 15:27:40 +07:00
LIBMNL_LIB_DIR = "${nixpkgs.lib.getLib pkgs.libmnl}/lib";
2024-08-11 00:54:48 +07:00
LIBNFTNL_LIB_DIR = "${nixpkgs.lib.getLib (pkgs.libnftnl.overrideAttrs (old: {
patches = (old.patches or []) ++ [ ./libnftnl-fix.patch ];
}))}/lib";
2024-08-10 07:37:04 +07:00
LD_LIBRARY_PATH = "${LIBMNL_LIB_DIR}:${LIBNFTNL_LIB_DIR}";
2024-08-09 15:27:40 +07:00
};
};
}