Skip to content

Commit 38dc759

Browse files
RTUnrealJulianGro
andcommitted
add nix package definition
Co-authored-by: Julian Groß <julian.g@posteo.de>
1 parent 15554d4 commit 38dc759

14 files changed

Lines changed: 503 additions & 0 deletions

flake.lock

Lines changed: 61 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
{
2+
inputs = {
3+
nixpkgs.url = "github:NixOS/nixpkgs?ref=nixos-unstable";
4+
flake-parts.url = "github:hercules-ci/flake-parts";
5+
};
6+
outputs =
7+
inputs:
8+
inputs.flake-parts.lib.mkFlake { inherit inputs; } (
9+
{ inputs, ... }:
10+
{
11+
systems = [
12+
"x86_64-linux"
13+
"aarch64-linux"
14+
"aarch64-darwin"
15+
];
16+
17+
perSystem =
18+
{
19+
pkgs,
20+
lib,
21+
self',
22+
inputs',
23+
...
24+
}:
25+
{
26+
packages = {
27+
glad = pkgs.callPackage ./nix/glad.nix { };
28+
etc2comp = pkgs.callPackage ./nix/etc2comp.nix { };
29+
30+
cgltf = pkgs.callPackage ./nix/cgltf.nix { };
31+
32+
artery-font-format = pkgs.callPackage ./nix/artery-font-format.nix { };
33+
34+
polyvox = pkgs.callPackage ./nix/polyvox.nix { };
35+
36+
gif_creator = pkgs.callPackage ./nix/gif_creator.nix { };
37+
38+
scribe = pkgs.callPackage ./nix/scribe.nix { };
39+
40+
overte = pkgs.callPackage ./nix/overte.nix {
41+
inherit (self'.packages)
42+
glad
43+
scribe
44+
gif_creator
45+
polyvox
46+
artery-font-format
47+
cgltf
48+
etc2comp
49+
draco
50+
glm
51+
;
52+
libv8 = pkgs.nodejs.libv8;
53+
};
54+
55+
# TODO: update/remove when overte updates to more modern version
56+
draco = pkgs.callPackage ./nix/draco.nix { };
57+
58+
glm = pkgs.callPackage ./nix/glm.nix { };
59+
};
60+
devShells.default = pkgs.mkShell {
61+
packages = [
62+
pkgs.conan
63+
pkgs.ninja
64+
pkgs.gdb
65+
];
66+
inputsFrom = [ self'.packages.overte ];
67+
68+
NVTT_DIR = "${pkgs.nvidia-texture-tools}";
69+
GLSLANG_DIR = "${pkgs.glslang}/bin";
70+
SCRIBE_DIR = "${self'.packages.scribe}/tools";
71+
SPIRV_CROSS_DIR = "${pkgs.spirv-cross}/bin";
72+
SPIRV_TOOLS_DIR = "${pkgs.spirv-tools}/bin";
73+
# Enable function alignment to fix crashes in relation to V8 scripting engine
74+
CXXFLAGS = "-falign-functions";
75+
};
76+
};
77+
}
78+
);
79+
}

nix/artery-font-format.nix

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{ stdenv, fetchFromGitHub }:
2+
stdenv.mkDerivation rec {
3+
pname = "artery-font-format";
4+
version = "1.1";
5+
src = fetchFromGitHub {
6+
owner = "Chlumsky";
7+
repo = "artery-font-format";
8+
tag = "v${version}";
9+
hash = "sha256-JozvSQJt/62083sGX0jwMC2xmmpYrGvwd9MIfHtnqCs=";
10+
};
11+
12+
installPhase = ''
13+
mkdir -p $out/include/
14+
cp -r artery-font $out/include/
15+
'';
16+
}

nix/cgltf.nix

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
stdenv,
3+
fetchFromGitHub,
4+
}:
5+
stdenv.mkDerivation rec {
6+
pname = "cgltf";
7+
version = "1.15";
8+
src = fetchFromGitHub {
9+
owner = "jkuhlmann";
10+
repo = "cgltf";
11+
tag = "v${version}";
12+
hash = "sha256-e+sVqcdOuLhsDHVntGzAwxtPxookrn706yEWDzNVvgI=";
13+
};
14+
outputs = [
15+
"out"
16+
"dev"
17+
];
18+
installPhase = ''
19+
mkdir -p $dev/include $out
20+
cp cgltf* $dev/include/
21+
'';
22+
}

nix/draco.diff

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
diff --git a/src/draco/core/hash_utils.h b/src/draco/core/hash_utils.h
2+
index dd910d0..1ca934f 100644
3+
--- a/src/draco/core/hash_utils.h
4+
+++ b/src/draco/core/hash_utils.h
5+
@@ -16,6 +16,7 @@
6+
#define DRACO_CORE_HASH_UTILS_H_
7+
8+
#include <stdint.h>
9+
+#include <cstddef>
10+
11+
#include <functional>
12+
13+
diff --git a/src/draco/io/file_utils.h b/src/draco/io/file_utils.h
14+
index 18f0f59..44c3258 100644
15+
--- a/src/draco/io/file_utils.h
16+
+++ b/src/draco/io/file_utils.h
17+
@@ -15,6 +15,7 @@
18+
#ifndef DRACO_IO_FILE_UTILS_H_
19+
#define DRACO_IO_FILE_UTILS_H_
20+
21+
+#include <cstdint>
22+
#include <string>
23+
#include <vector>
24+
25+
diff --git a/src/draco/io/parser_utils.cc b/src/draco/io/parser_utils.cc
26+
index 6e42a58..45df9d1 100644
27+
--- a/src/draco/io/parser_utils.cc
28+
+++ b/src/draco/io/parser_utils.cc
29+
@@ -18,6 +18,7 @@
30+
#include <cctype>
31+
#include <cmath>
32+
#include <iterator>
33+
+#include <limits>
34+
35+
namespace draco {
36+
namespace parser {

nix/draco.nix

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# copied from: https://github.com/NixOS/nixpkgs/blob/6a78816d7420ba5cb3093d4f0412d2bf0a57bfdd/pkgs/development/libraries/draco/default.nix
2+
{
3+
stdenv,
4+
lib,
5+
fetchFromGitHub,
6+
cmake,
7+
}:
8+
stdenv.mkDerivation rec {
9+
version = "1.3.6";
10+
pname = "draco";
11+
src = fetchFromGitHub {
12+
owner = "google";
13+
repo = "draco";
14+
rev = version;
15+
hash = "sha256-QJUEF+AzI+Nt52CvVKETFxOgOzFVfo8SNtpa/dCHTRk=";
16+
};
17+
patches = [ ./draco.diff ];
18+
enableParallelBuilding = true;
19+
nativeBuildInputs = [ cmake ];
20+
cmakeFlags = [
21+
# Fake these since we are building from a tarball
22+
"-Ddraco_git_hash=${version}"
23+
"-Ddraco_git_desc=${version}"
24+
"-DBUILD_UNITY_PLUGIN=1"
25+
];
26+
}

nix/etc2comp.nix

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
stdenv,
3+
fetchFromGitHub,
4+
cmake,
5+
}:
6+
stdenv.mkDerivation {
7+
pname = "etc2comp";
8+
version = "unstable-2022-06-01";
9+
src = fetchFromGitHub {
10+
owner = "google";
11+
repo = "etc2comp";
12+
rev = "39422c1aa2f4889d636db5790af1d0be6ff3a226";
13+
hash = "sha256-mLr2Fsn9s9eWi71ljCll8c1hCk+dW6jCr7GG67ZTZ00=";
14+
};
15+
nativeBuildInputs = [ cmake ];
16+
outputs = [
17+
"out"
18+
"dev"
19+
"lib"
20+
];
21+
installPhase = ''
22+
mkdir -p $lib/lib $dev/include $out/bin
23+
cp EtcLib/libEtcLib.a $lib/lib/
24+
cp EtcTool/EtcTool $out/bin/
25+
cp -r ../EtcLib $dev/include/
26+
'';
27+
meta.mainProgram = "EtcTool";
28+
}

nix/gif_creator.nix

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{ stdenv, fetchzip }:
2+
stdenv.mkDerivation {
3+
pname = "GifCreator";
4+
version = "2016.11";
5+
src = fetchzip {
6+
url = "https://build-deps.overte.org/dependencies/GifCreator.zip";
7+
hash = "sha256-WxYVy8T10ASsrvnHUdaoeh7befsFDlpR6ZsFtXTgFWA=";
8+
};
9+
10+
installPhase = ''
11+
mkdir -p $out/include/GifCreator
12+
cp GifCreator.h $out/include/GifCreator/
13+
'';
14+
}

0 commit comments

Comments
 (0)