-
Notifications
You must be signed in to change notification settings - Fork 0
/
default.nix
177 lines (164 loc) · 4.91 KB
/
default.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
{ pkgsFun ? import <nixpkgs>
, pkgs ? pkgsFun {}
, lib ? pkgs.lib
, coil
, features ? null
}:
lib.makeExtensible (self: with self; {
# NixOS build
nixos-pkgs = pkgs.extend (self: super: with self; {
coil-core = (callPackage ./coil-core.nix {
inherit features;
}).overrideAttrs (attrs: {
cmakeFlags = (attrs.cmakeFlags or []) ++ [
# force clang
"-DCMAKE_CXX_COMPILER=clang++"
"-DCMAKE_C_COMPILER=clang"
# do not require some libs
"-DCOIL_CORE_DONT_REQUIRE_LIBS=${dontRequireLibsList}"
];
nativeBuildInputs = attrs.nativeBuildInputs ++ [
clang
];
});
libsquish = stdenv.mkDerivation rec {
pname = "libsquish";
version = "1.15";
src = pkgs.fetchurl {
url = "https://downloads.sourceforge.net/libsquish/libsquish-${version}.tgz";
hash = "sha256-YoeW7rpgiGYYOmHQgNRpZ8ndpnI7wKPsUjJMhdIUcmk=";
};
sourceRoot = ".";
nativeBuildInputs = [
cmake
ninja
];
buildInputs = [
openmp
];
cmakeFlags = [
"-DBUILD_SHARED_LIBS=ON"
];
meta.license = lib.licenses.mit;
};
libwebm = stdenv.mkDerivation rec {
pname = "libwebm";
version = "1.0.0.31";
src = pkgs.fetchgit {
url = "https://chromium.googlesource.com/webm/libwebm";
rev = "libwebm-${version}";
hash = "sha256-+ayX33rcX/jkewsW8WrGalTe9X44qFBHOrIYTteOQzc=";
};
nativeBuildInputs = [
cmake
ninja
];
cmakeFlags = [
"-DENABLE_WEBM_PARSER=ON"
];
meta.license = lib.licenses.bsd3;
};
libgav1 = stdenv.mkDerivation rec {
pname = "libgav1";
version = "0.19.0";
src = pkgs.fetchgit {
url = "https://chromium.googlesource.com/codecs/libgav1";
rev = "v${version}";
hash = "sha256-kuDXv8H24UwyrOK0cAsTSvMPFCkPI8qUcj5u9WwgfkU=";
};
nativeBuildInputs = [
cmake
ninja
];
cmakeFlags = [
# https://github.com/NixOS/nixpkgs/issues/144170
"-DCMAKE_INSTALL_INCLUDEDIR=include"
"-DCMAKE_INSTALL_LIBDIR=lib"
# eliminate abseil dependency
"-DLIBGAV1_THREADPOOL_USE_STD_MUTEX=1"
"-DLIBGAV1_ENABLE_EXAMPLES=0"
"-DLIBGAV1_ENABLE_TESTS=0"
];
meta.license = lib.licenses.asl20;
};
mbedtls = super.mbedtls.overrideAttrs (attrs: {
postConfigure = (attrs.postConfigure or "") + ''
perl scripts/config.pl set MBEDTLS_SSL_DTLS_SRTP
'';
});
inherit (llvmPackages) openmp;
libdatachannel = callPackage ./pkgs/libdatachannel.nix {};
plog = callPackage ./pkgs/plog.nix {};
libjuice = callPackage ./pkgs/libjuice.nix {};
libsrtp = callPackage ./pkgs/libsrtp.nix {};
steam-sdk = if coil.toolchain-steam != null then coil.toolchain-steam.sdk else null;
});
coil-core-nixos = nixos-pkgs.coil-core;
# Ubuntu build
ubuntu-pkgs = rec {
clangVersion = "18";
diskImage = coil.toolchain-linux.diskImagesFuns.ubuntu_2204_amd64 [
"clang-${clangVersion}"
"cmake"
"ninja-build"
"pkg-config"
"libsdl2-dev"
"libvulkan-dev"
"spirv-headers"
"nlohmann-json3-dev"
"libzstd-dev"
"libsqlite3-dev"
"libmbedtls-dev"
"libpng-dev"
"libsquish-dev"
"libfreetype-dev"
"libharfbuzz-dev"
"libwayland-dev"
"wayland-protocols"
"libxkbcommon-dev"
"libpulse-dev"
"libogg-dev"
"libwebm-dev"
"libopus-dev"
"libgav1-dev"
"libcurl4-openssl-dev"
];
coil-core = pkgs.vmTools.runInLinuxImage ((pkgs.callPackage ./coil-core.nix {
inherit features;
libsquish = null;
libwebm = null;
libgav1 = null;
steam-sdk = if coil.toolchain-steam != null then coil.toolchain-steam.sdk else null;
}).overrideAttrs (attrs: {
propagatedBuildInputs = [];
cmakeFlags = (attrs.cmakeFlags or []) ++ [
# force clang
"-DCMAKE_CXX_COMPILER=clang++-${clangVersion}"
"-DCMAKE_C_COMPILER=clang-${clangVersion}"
# some libs do not work yet
"-DCOIL_CORE_DONT_REQUIRE_LIBS=compress_zstd"
# steam
"-DSteam_INCLUDE_DIRS=${coil.toolchain-steam.sdk}/include"
"-DSteam_LIBRARIES=${coil.toolchain-steam.sdk}/lib/libsteam_api.so"
];
inherit diskImage;
diskImageFormat = "qcow2";
memSize = 2048;
enableParallelBuilding = true;
}));
};
coil-core-ubuntu = ubuntu-pkgs.coil-core;
# Windows build
windows-pkgs = import ./pkgs/windows-pkgs.nix {
pkgs = nixos-pkgs;
inherit lib coil dontRequireLibsList;
};
coil-core-windows = windows-pkgs.coil-core;
# list of libs to not require if dependencies not available
dontRequireLibsList = lib.concatStringsSep ";" (lib.concatLists [
(lib.optional (coil.toolchain-steam == null) "steam")
]);
touch = {
inherit coil-core-nixos coil-core-ubuntu coil-core-windows;
};
})