This commit is contained in:
Winter Hille 2025-08-29 18:04:07 -07:00
commit cde73248ec
11 changed files with 1011 additions and 0 deletions

72
flake.nix Normal file
View file

@ -0,0 +1,72 @@
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{
self,
nixpkgs,
fenix,
}:
let
pkgs = nixpkgs.legacyPackages.x86_64-linux // {
ggwave = pkgs.stdenv.mkDerivation rec {
pname = "ggwave";
version = "0.4.1";
src = pkgs.fetchFromGitHub {
owner = "ggerganov";
repo = "ggwave";
rev = "${pname}-v${version}";
hash = "sha256-tymG9JC+Anb3D26EwMF8laz8xvGnrEA+tqMmGBAnY7o=";
fetchSubmodules = true;
};
nativeBuildInputs = [ pkgs.cmake ];
cmakeFlags = [
"-DGGWAVE_BUILD_EXAMPLES=OFF"
"-DCMAKE_BUILD_TYPE=Release"
];
doCheck = true;
installPhase = ''
# for some reason nix won't copy the include even though cmake tells it to
mkdir -p $out/include
cp -r $src/include/* $out/include
cmake --install . --prefix=$out
'';
};
};
rustPkgs = fenix.packages.x86_64-linux.default;
in
with pkgs;
{
devShells.x86_64-linux.default = mkShell {
packages = [
pkg-config
cmake
clang
pkgs.ggwave
]
++ (with rustPkgs; [
cargo
clippy
rustc
rustfmt
]);
GGWAVE_PATH = "${pkgs.ggwave}";
LD_LIBRARY_PATH = "${pkgs.ggwave}/lib";
LIBCLANG_PATH = "${pkgs.llvmPackages.libclang.lib}/lib";
};
};
}