Package for Nix

Signed-off-by: Slendi <slendi@socopon.com>
This commit is contained in:
2025-08-24 19:37:31 +03:00
parent c2f44d2bb7
commit 6467461b3b
2 changed files with 52 additions and 0 deletions

1
.gitignore vendored
View File

@@ -1,2 +1,3 @@
[Bb]uild*
.cache
result

View File

@@ -1,4 +1,9 @@
let
desc = "Single-file linear algebra math library for C++23.";
in
{
description = desc;
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
@@ -27,6 +32,52 @@
pkg-config
];
};
packages.default = pkgs.stdenv.mkDerivation {
pname = "smath";
version = "master";
src = ./.;
nativeBuildInputs = [ pkgs.copyPkgconfigItems ];
pkgconfigItems = [
(pkgs.makePkgconfigItem rec {
name = "smath";
version = "1";
cflags = [ "-I${variables.includedir}" ];
variables = rec {
prefix = "${placeholder "out"}";
includedir = "${prefix}/include";
};
description = desc;
})
];
dontBuild = true;
installPhase = ''
runHook preInstall
mkdir -p $out/include
cp include/*.hpp $out/include/
runHook postInstall
'';
meta = with pkgs.lib; {
description = desc;
homepage = "https://github.com/slendidev/smath";
license = licenses.asl20;
platforms = platforms.all;
maintainers = [
{
name = "Slendi";
email = "slendi@socopon.com";
github = "slendidev";
githubId = 32436619;
}
];
};
};
}
);
}