-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdefault.nix
More file actions
133 lines (117 loc) · 2.94 KB
/
default.nix
File metadata and controls
133 lines (117 loc) · 2.94 KB
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
{
lib,
stdenv,
python3,
wrapGAppsHook4,
gobject-introspection,
makeWrapper,
gtk4,
libadwaita,
gst_all_1,
ffmpeg,
v4l-utils,
gphoto2,
pipewire,
libcamera,
zbar,
polkit,
}:
let
pythonEnv = python3.withPackages (ps:
with ps; [
pygobject3
pycairo
numpy
opencv4
qrcode
aiohttp
]
);
in
stdenv.mkDerivation {
pname = "bigcam";
version = "4.4.4";
src = ./.;
nativeBuildInputs = [
wrapGAppsHook4
gobject-introspection
makeWrapper
];
buildInputs = [
gtk4
libadwaita
gst_all_1.gstreamer
gst_all_1.gst-plugins-base
gst_all_1.gst-plugins-good
gst_all_1.gst-plugins-bad
gst_all_1.gst-plugins-ugly
gst_all_1.gst-plugin-gtk4
ffmpeg
v4l-utils
gphoto2
pipewire
libcamera
zbar
polkit
];
dontBuild = true;
dontConfigure = true;
dontWrapGApps = true;
installPhase = ''
runHook preInstall
# Application files
mkdir -p $out/share/biglinux/bigcam
cp -r usr/share/biglinux/bigcam/* $out/share/biglinux/bigcam/
# Desktop file
mkdir -p $out/share/applications
cp usr/share/applications/*.desktop $out/share/applications/
# System icons
mkdir -p $out/share/icons
cp -r usr/share/icons/* $out/share/icons/
# Locale / translations
if [ -d usr/share/locale ]; then
mkdir -p $out/share/locale
cp -r usr/share/locale/* $out/share/locale/
fi
# System config (polkit, modprobe, sudoers)
if [ -d etc ]; then
mkdir -p $out/etc
cp -r etc/* $out/etc/
fi
# Launcher script
mkdir -p $out/bin
cat > $out/bin/bigcam <<'LAUNCHER'
#!/bin/bash
exec python3 @out@/share/biglinux/bigcam/main.py "$@"
LAUNCHER
chmod +x $out/bin/bigcam
substituteInPlace $out/bin/bigcam --replace-fail "@out@" "$out"
# Fix desktop file paths
substituteInPlace $out/share/applications/*.desktop \
--replace-quiet "/usr/share/biglinux/bigcam" "$out/share/biglinux/bigcam" \
--replace-quiet "/usr/bin/bigcam" "$out/bin/bigcam"
runHook postInstall
'';
postFixup = ''
wrapProgram $out/bin/bigcam \
"''${gappsWrapperArgs[@]}" \
--prefix PATH : "${lib.makeBinPath [ pythonEnv ffmpeg v4l-utils gphoto2 ]}" \
--prefix PYTHONPATH : "$out/share/biglinux/bigcam" \
--prefix PYTHONPATH : "${pythonEnv}/${pythonEnv.sitePackages}" \
--prefix GI_TYPELIB_PATH : "${lib.makeSearchPath "lib/girepository-1.0" buildInputs}" \
--prefix GST_PLUGIN_PATH : "${lib.makeSearchPath "lib/gstreamer-1.0" [
gst_all_1.gst-plugins-base
gst_all_1.gst-plugins-good
gst_all_1.gst-plugins-bad
gst_all_1.gst-plugins-ugly
gst_all_1.gst-plugin-gtk4
]}"
'';
meta = with lib; {
description = "Universal webcam control center for Linux";
homepage = "https://github.com/biglinux/bigcam";
license = licenses.gpl3;
platforms = platforms.linux;
mainProgram = "bigcam";
};
}