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

add nerf projects + expose overlayed packages #36

Draft
wants to merge 10 commits into
base: master
Choose a base branch
from
Draft
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
18 changes: 18 additions & 0 deletions flake.lock

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

6 changes: 6 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
url = "github:koboldai/koboldai-client/1.19.2";
flake = false;
};
nerfstudio-src = {
url = "github:nerfstudio-project/nerfstudio/v0.3.1";
flake = false;
};
flake-parts = {
url = "github:hercules-ci/flake-parts";
inputs.nixpkgs-lib.follows = "nixpkgs";
Expand All @@ -38,6 +42,8 @@
./modules/aipython3
./projects/invokeai
./projects/koboldai
./projects/nerfstudio
./projects/pkgs
./website
];
};
Expand Down
22 changes: 22 additions & 0 deletions modules/aipython3/overlays.nix
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ pkgs: {
broken = false;
};
});
scikitimage = prev.scikitimage.overrideAttrs (old: {
# fix weird crash
prePatch = (old.prePatch or "") + ''
substituteInPlace skimage/color/colorconv.py \
--replace 'from scipy import linalg' 'from numpy import linalg'
'';
});
streamlit = let
streamlit = final.callPackage (pkgs.path + "/pkgs/applications/science/machine-learning/streamlit") {
protobuf3 = final.protobuf;
Expand Down Expand Up @@ -82,6 +89,20 @@ pkgs: {
clip-anytorch = callPackage ../../packages/clip-anytorch { };
clean-fid = callPackage ../../packages/clean-fid { };
getpass-asterisk = callPackage ../../packages/getpass-asterisk { };
pymeshlab = callPackage ../../packages/pymeshlab { };
viser = callPackage ../../packages/viser { };
tyro = callPackage ../../packages/tyro { };
nerfacc = callPackage ../../packages/nerfacc { };
open3d = callPackage ../../packages/open3d { };
zipnerf-pytorch = callPackage ../../packages/zipnerf-pytorch { };
liblzf = callPackage ../../packages/liblzf { };
rawpy = callPackage ../../packages/rawpy { };
pycolmap = callPackage ../../packages/pycolmap { };
torch_scatter = callPackage ../../packages/torch_scatter { };
libigl = callPackage ../../packages/libigl { };
glad = callPackage ../../packages/glad { };
openctm = callPackage ../../packages/openctm { };
u3d = callPackage ../../packages/u3d { };
};

torchRocm = final: prev: rec {
Expand Down Expand Up @@ -115,4 +136,5 @@ pkgs: {
torch = final.torch-bin;
torchvision = final.torchvision-bin;
};

}
20 changes: 20 additions & 0 deletions packages/glad/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{ buildPythonPackage
, fetchFromGitHub
, lib
, jinja2
, cmake
}:

buildPythonPackage rec {
pname = "glad";
version = "2.0.4";

src = fetchFromGitHub {
owner = "Dav1dde";
repo = "glad";
rev = "v${version}";
sha256 = "sha256-Sq7VUhRnGvHtVlLv1b7pyA+x8u3/cxNxxp5VBms0Vd0=";
};

propagatedBuildInputs = [ jinja2 ];
}
225 changes: 225 additions & 0 deletions packages/libigl/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,225 @@
{ buildPythonPackage
, fetchzip
, fetchgit
, lib
, unzip
, cmake
, gmp
, mpfr
, eigen
, pkg-config
, embree
, libGL
, glfw
, boost
, cgal
, catch2
, glad
, ispc
, tbb
, imgui
, tinyxml2
, libpng
, xorg
, stb
}:

let
getFetchContent = { cmakeFile, hashes ? {} }: let
inherit (builtins) readFile split filter match typeOf head tail foldl';
inherit (lib) pipe flatten;

data = pipe (readFile cmakeFile) [
(split "\n")
(filter (x: typeOf x == "string"))
(flatten)
(map (match " *(.*GIT.*) *"))
(flatten)
(filter (x: x != null))
(map (x: let line = lib.pipe x [
(split " ")
(filter (v: typeOf v == "string" && v != ""))
]; in { "${head line}" = "${head (tail line)}";}))
(foldl' (x: y: x // y) {})
];

rev = builtins.replaceStrings [ "tags/" ] [ "" ] data.GIT_TAG;
in fetchgit {
url = "${data.GIT_REPOSITORY}";
inherit rev;
sha256 = hashes.${rev} or (builtins.trace "getFetchContent: fallback hash for '${data.GIT_REPOSITORY}' '${data.GIT_TAG}'" lib.fakeSha256);
};

version = "2.4.0";
src = fetchzip {
url = "https://www.meshlab.net/data/libs/libigl-${version}.zip";
sha256 = "sha256-HRD854Y/F2jwVKEvewbYYy/rgf3tmEb8ZFCtbtG9lmI=";
};

inputs = {
embree = {
"v3.13.3" = "sha256-g6BsXMNUvx17hgAq0PewtBLgtWqpp03M0k6vWNapDKs=";
};
tinyxml2 = {
"d175e9de0be0d4db75d0a8cf065599a435a87eb6" = "sha256-g5D88Vl2EhtEp+jh5J0+T+P5hM7raM/41qh3Ud9Sg6o=";
};
stb = {
"f67165c2bb2af3060ecae7d20d6f731173485ad0" = "sha256-b/T+8omHlUVmA6a+66FbgH++iXy4cZJD3Q5HTXApGa0=";
};
libigl_imgui_fonts = {
"7e1053e750b0f4c129b046f4e455243cb7f804f3" = "sha256-3+rscFLD0OvsjRJIDRvENSf4Vorons6QDV6pXBVCYRM=";
};
catch2 = {
"v2.13.8" = "sha256-jOA2TxDgaJUJ2Jn7dVGZUbjmphTDuVZahzSaxfJpRqE=";
};
eigen = {
"3.3.7" = "sha256-oXJ4V5rakL9EPtQF0Geptl0HMR8700FdSrOB09DbbMQ=";
};
glad = {
"09b4969c56779f7ddf8e6176ec1873184aec890f" = "sha256-k6s8Ct3FGPq43+5bAvq56bGrqPsys7P7M5f6EcrRmWc=";
};
glfw = {
"3327050ca66ad34426a82c217c2d60ced61526b7" = "sha256-XBVxtkL29WqQooM2+wkorjjWIpXj0g3X8rkGhSiNoxI=";
};
imguizmo = {
"a23567269f6617342bcc112394bdad937b54b2d7" = "sha256-l5BOeBkJlX6VAGNDM+Ouc8YnwooRqzZbcmRFyeO/ZCU=";
};
imgui = {
"v1.85" = "sha256-HQsGlsvmf3ikqhGnJHf/d6SRCY/QDeW7XUTwXQH/JYE=";
};
libigl_tests_data = {
"name" = "libigl_tests_tata";
"19cedf96d70702d8b3a83eb27934780c542356fe" = "sha256-IhLlfe89utbIks/z1Re1dbgUDqpX1iqJIryTw3umr/M=";
};
};

inputsCMakeVars = lib.pipe inputs [
(builtins.attrNames)
(map (dir: "-DFETCHCONTENT_SOURCE_DIR_${lib.toUpper (inputs.${dir}.name or dir)}=../.${dir}"))
];

inputsDerivations = builtins.mapAttrs (k: v: getFetchContent {
cmakeFile = "${src}/cmake/recipes/external/${k}.cmake";
hashes = inputs.${k};
}) inputs;

inputsPatchPhase = lib.pipe inputsDerivations [
(builtins.attrNames)
(map (k: "cp -r ${inputsDerivations.${k}} -r .${k}; chmod +w .${k} -R"))
(builtins.concatStringsSep "\n")
];

in

buildPythonPackage rec {
pname = "libigl";

inherit src version;

format = "other";

cmakeSuffix = ''
# include(FindPkgConfig)
# find_package(eigen REQUIRED eigen-populate)
# find_package(glfw3 REQUIRED glfw)
# find_package(glad REQUIRED)
'';

prePatch = ''
${inputsPatchPhase}

echo "$cmakeSuffix" >> CMakeLists.txt
'';

cmakeFlags = inputsCMakeVars ++ [
# "-DFETCHCONTENT_FULLY_DISCONNECTED=ON"
"-DLIBGL_EMBREE=OFF"
"-DFETCHCONTENT_TRY_FIND_PACKAGE_MODE=ALWAYS"
"-DLIBIGL_BUILD_TUTORIALS=OFF"
"-DLIBIGL_COPYLEFT_CGAL=OFF"
"-DLIBIGL_COPYLEFT_COMISO=OFF"
"-DLIBIGL_COPYLEFT_CORE=OFF"
"-DLIBIGL_COPYLEFT_CORK=OFF"
"-DLIBIGL_COPYLEFT_TETGEN=OFF"
"-DLIBIGL_PREDICATES=OFF"
"-DLIBIGL_RESTRICTED_MATLAB=OFF"
"-DLIBIGL_RESTRICTED_MOSEK=OFF"
"-DLIBIGL_RESTRICTED_TRIANGLE=OFF"
"-DTBB_DIR=${tbb.src}"
# "-DFETCHCONTENT_SOURCE_DIR_EMBREE=../.embree" # embree needs to be in a mutable location
# "-DFETCHCONTENT_SOURCE_DIR_TINYXML2=${getFetchContent {
# cmakeFile = "${src}/cmake/recipes/external/tinyxml2.cmake";
# hashes = {
# "d175e9de0be0d4db75d0a8cf065599a435a87eb6" = "sha256-g5D88Vl2EhtEp+jh5J0+T+P5hM7raM/41qh3Ud9Sg6o=";
# };
# }}"
# "-DFETCHCONTENT_SOURCE_DIR_STB=${getFetchContent {
# cmakeFile = "${src}/cmake/recipes/external/stb.cmake";
# hashes = {
# "f67165c2bb2af3060ecae7d20d6f731173485ad0" = "sha256-b/T+8omHlUVmA6a+66FbgH++iXy4cZJD3Q5HTXApGa0=";
# };
# }}"
# "-DFETCHCONTENT_SOURCE_DIR_LIBIGL_IMGUI_FONTS=${getFetchContent {
# cmakeFile = "${src}/cmake/recipes/external/libigl_imgui_fonts.cmake";
# hashes = {
# "7e1053e750b0f4c129b046f4e455243cb7f804f3" = "sha256-3+rscFLD0OvsjRJIDRvENSf4Vorons6QDV6pXBVCYRM=";
# };
# }}"
# "-DFETCHCONTENT_SOURCE_DIR_CATCH2=${getFetchContent {
# cmakeFile = "${src}/cmake/recipes/external/catch2.cmake";
# hashes = {
# "v2.13.8" = "sha256-jOA2TxDgaJUJ2Jn7dVGZUbjmphTDuVZahzSaxfJpRqE=";
# };
# }}"
# "-DFETCHCONTENT_SOURCE_DIR_EIGEN=${getFetchContent {
# cmakeFile = "${src}/cmake/recipes/external/eigen.cmake";
# hashes = {
# "3.3.7" = "sha256-oXJ4V5rakL9EPtQF0Geptl0HMR8700FdSrOB09DbbMQ=";
# };
# }}"
# "-DFETCHCONTENT_SOURCE_DIR_GLAD=${getFetchContent {
# cmakeFile = "${src}/cmake/recipes/external/glad.cmake";
# hashes = {
# "09b4969c56779f7ddf8e6176ec1873184aec890f" = "sha256-k6s8Ct3FGPq43+5bAvq56bGrqPsys7P7M5f6EcrRmWc=";
# };
# }}"
# "-DFETCHCONTENT_SOURCE_DIR_GLFW=${getFetchContent {
# cmakeFile = "${src}/cmake/recipes/external/glfw.cmake";
# hashes = {
# "3327050ca66ad34426a82c217c2d60ced61526b7" = "sha256-XBVxtkL29WqQooM2+wkorjjWIpXj0g3X8rkGhSiNoxI=";
# };
# }}"
# "-DFETCHCONTENT_SOURCE_DIR_IMGUIZMO=${getFetchContent {
# cmakeFile = "${src}/cmake/recipes/external/imguizmo.cmake";
# hashes = {
# "a23567269f6617342bcc112394bdad937b54b2d7" = "sha256-l5BOeBkJlX6VAGNDM+Ouc8YnwooRqzZbcmRFyeO/ZCU=";
# };
# }}"
# "-DFETCHCONTENT_SOURCE_DIR_IMGUI=${getFetchContent {
# cmakeFile = "${src}/cmake/recipes/external/imgui.cmake";
# hashes = {
# "v1.85" = "sha256-HQsGlsvmf3ikqhGnJHf/d6SRCY/QDeW7XUTwXQH/JYE=";
# };
# }}"
# "-DFETCHCONTENT_SOURCE_DIR_LIBIGL_TESTS_TATA=${getFetchContent {
# cmakeFile = "${src}/cmake/recipes/external/libigl_tests_data.cmake";
# hashes = {
# "19cedf96d70702d8b3a83eb27934780c542356fe" = "sha256-IhLlfe89utbIks/z1Re1dbgUDqpX1iqJIryTw3umr/M=";
# };
# }}"
];

nativeBuildInputs = [ unzip cmake gmp pkg-config ];

buildInputs = [
mpfr
libGL
libpng
xorg.libX11
xorg.libXrandr
xorg.libXinerama
xorg.libXcursor
xorg.libXi
stb
];
}
14 changes: 14 additions & 0 deletions packages/liblzf/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{ stdenv
, lib
, fetchurl
}:

stdenv.mkDerivation rec {
pname = "liblzf";
version = "3.6";

src = fetchurl {
url = "http://dist.schmorp.de/liblzf/liblzf-${version}.tar.gz";
sha256 = "sha256-nF3gH3ucyuQMP2GdJqer7JmGwGw20mDBec7dBLiftGo=";
};
}
Loading