Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic Nix package and flake support #1663

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
(import (fetchTarball
"https://github.com/edolstra/flake-compat/archive/master.tar.gz") {
src = builtins.fetchGit ./.;
}).defaultNix
27 changes: 27 additions & 0 deletions flake.lock

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

14 changes: 14 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
description = "openvdb";
inputs = {
# pick latest commit from stable branch and test it so no suprises
nixpkgs.url = "github:NixOS/nixpkgs/d53978239b265066804a45b7607b010b9cb4c50c";
};

outputs = inputs: {

defaultPackage.x86_64-linux = import ./openvdb.nix {
nixpkgs = inputs.nixpkgs;
};
};
}
42 changes: 42 additions & 0 deletions openvdb.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{ nixpkgs, ... }:
let
pkgs = import nixpkgs {
system = "x86_64-linux";
overlays = [ (import ./overlay.nix) ];
};
in
with pkgs;
stdenv.mkDerivation {
name = "openvdb";
version = "9.0.0";

# https://nixos.org/nix/manual/#builtin-filterSource
src = builtins.filterSource
(path: type: lib.cleanSourceFilter path type
&& baseNameOf path != "doc/*"
&& baseNameOf path != "openvdb_houdini/*"
&& baseNameOf path != "openvdb_maya/*"
&& baseNameOf path != "pendingchanges/*"
&& baseNameOf path != "tsc/*") ./.;

cmakeFlags =["-DOPENVDB_BUILD_VDB_VIEW=ON"];

# easily maxes out RAM on github actions or systems <64 GB
enableParallelBuilding = true;
nativeBuildInputs = [ cmake pkg-config ];

# required dependencies for downstream development
propagatedBuildInputs = [
openexr
tbb
c-blosc
boost175
];

buildInputs = [
unzip jemalloc ilmbase
# for the optional VDB_VIEW binary opengl related dependencies:
libGL glfw3 x11 libGLU xorg.libXdmcp
];

}
39 changes: 39 additions & 0 deletions overlay.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
final: prev: {
tbb = prev.stdenv.mkDerivation {
name="tbb";
version = "2021.4";

src = prev.fetchFromGitHub {
owner = "oneapi-src";
repo = "oneTBB";
rev = "v2021.4.0";
sha256 = "eJ/NQ1XkWWlioBu05zbtZ/EwVxCAQzz5pkkKgN4RB0Y=";
};

nativeBuildInputs = [ prev.pkgs.cmake prev.pkgs.pkg-config ];

makeFlags = prev.lib.optionals prev.stdenv.cc.isClang [
"compiler=clang"
];

cmakeFlags =["-DTBB_TEST=OFF"];

enableParallelBuilding = true;

meta = with prev.lib; {
description = "Intel Thread Building Blocks C++ Library";
homepage = "http://threadingbuildingblocks.org/";
license = licenses.asl20;
longDescription = ''
Intel Threading Building Blocks offers a rich and complete approach to
expressing parallelism in a C++ program. It is a library that helps you
take advantage of multi-core processor performance without having to be a
threading expert. Intel TBB is not just a threads-replacement library. It
represents a higher-level, task-based parallelism that abstracts platform
details and threading mechanisms for scalability and performance.
'';
platforms = platforms.unix;
maintainers = with maintainers; [ thoughtpolice dizfer ];
};
};
}
4 changes: 4 additions & 0 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
(import (fetchTarball
"https://github.com/edolstra/flake-compat/archive/master.tar.gz") {
src = builtins.fetchGit ./.;
}).shellNix