-
Notifications
You must be signed in to change notification settings - Fork 0
/
mize_module.nix
133 lines (102 loc) · 3.01 KB
/
mize_module.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
{
module = { buildMizeForSystem, mizeBuildConfig, mkMizeRustModule, crossSystem, pkgsCross, mkMizeRustShell, pkgs, pkgsNative, buildNpmPackage, mkSelString, ... }: let
selector_string = mkSelString {
modName = "mme";
};
hash = builtins.substring 0 32 (builtins.hashString "sha256" selector_string);
in mkMizeRustModule ({
modName = "mme";
src = ./.;
cargoExtraArgs = "--no-default-features --lib";
## add the js-runtimme
postInstall = let
url = "file:///home/me/work/mme/dist/mize.js";
html = ''
<html>
<head>
<!-- script src="https://c2vi.dev/mize/wasm32-none-unknown/mize.js"></script --!>
<script src="${url}"></script>
<script>
console.log("from script")
</script>
</head>
<body>
hello world...............
</body>
</html>
'';
in ''
echo -en "${html}" > $out/index.html
'';
}
// (if crossSystem.kernel.name == "linux" then builtins.trace "adding linux stuff" {
nativeBuildInputs = with pkgsCross.buildPackages; [
pkg-config
];
buildInputs = with pkgsNative; [
webkitgtk_4_1
];
} else {})
# add the devShell
// {
devShell = mkMizeRustShell {
nativeBuildInputs = with pkgs; [
#emscripten
wasm-pack
pkg-config
webkitgtk_4_1
libsForQt5.full
cmake
nasm
pkg-config
nodejs
];
buildInputs = with pkgs; [
openssl
#pango
#libsoup_3
webkitgtk_4_1
# gobject-introspection gtk4 atkmm
];
shellHook = ''
echo hiiiiiiiiiiiiii
export LD_LIBRARY_PATH=${pkgs.webkitgtk_4_1}/lib:${pkgs.libsoup_3}/lib:${pkgs.glib.out}/lib:${pkgs.gtk3}/lib:${pkgs.cairo}/lib:${pkgs.gdk-pixbuf}/lib:${pkgs.libxkbcommon}/lib:${pkgs.fontconfig.lib}/lib:${pkgs.libsForQt5.full}/lib:${pkgs.stdenv.cc.cc.lib}/lib:${pkgs.libsForQt5.qt5.qtwebengine}/lib
export CPLUS_INCLUDE_PATH=${pkgs.libsForQt5.full}/include:${pkgs.libsForQt5.qt5.qtwebengine}/include
export MME_QT_LIB=${pkgs.libsForQt5.full}/lib
# i found that this is the env war to set where QT looks for platform plugins
# at: https://forums.fedoraforum.org/showthread.php?326508-How-to-set-QT_QPA_PLATFORM_PLUGIN_PATH
export QT_QPA_PLATFORM_PLUGIN_PATH=${pkgs.libsForQt5.full}/lib/qt-5.15.14/plugins/platforms/
alias run="${./.}/run.sh"
'';
};
}
);
lib = { mkMizeModule, buildNpmPackage, ... }: rec {
mkMmePresenter = attrs: mkMizeModule (attrs // {
src = attrs.src;
modName = attrs.name;
select = {
mme_presenter = true;
};
});
mkMmeNpmPresenter = attrs: buildNpmPackage (attrs // {
});
mkMmeHtmlPresenter = attrs: mkMmePresenter ({
dontUnpack = true;
dontPath = true;
buildPhase = "";
installPhase = ''
mkdir -p $out
cp -r ${attrs.src}/* $out
'';
} // attrs);
};
externals = { fetchFromGitHub, ... }: [
(fetchFromGitHub {
owner = "c2vi";
repo = "mme-presenters";
rev = "master";
hash = "sha256-FeMBDCJBkw9XOLXC1rfedNk71uyg4OTCHaaO1jAAGto=";
})
];
}