1{
2 lib,
3 fetchFromGitHub,
4 replaceVars,
5 buildGoModule,
6 pkg-config,
7 deepin-gettext-tools,
8 gettext,
9 python3,
10 wrapGAppsHook3,
11 ddcutil,
12 alsa-lib,
13 glib,
14 gtk3,
15 libgudev,
16 libinput,
17 libnl,
18 librsvg,
19 linux-pam,
20 libxcrypt,
21 networkmanager,
22 pulseaudio,
23 gdk-pixbuf-xlib,
24 tzdata,
25 xkeyboard_config,
26 runtimeShell,
27 dbus,
28 util-linux,
29 dde-session-ui,
30 coreutils,
31 lshw,
32 dmidecode,
33 systemd,
34 udevCheckHook,
35}:
36
37buildGoModule rec {
38 pname = "dde-daemon";
39 version = "6.0.43";
40
41 src = fetchFromGitHub {
42 owner = "linuxdeepin";
43 repo = pname;
44 rev = version;
45 hash = "sha256-3BzFFlcNwNWNcysD3qRYfdyGaX7gW2XJZ4HzdGiK7jU=";
46 };
47
48 vendorHash = "sha256-3kUAaVXERqNZhBFytzVbWY6/a8M0jIkWrN+QHdWp1HU=";
49
50 patches = [
51 ./0001-dont-set-PATH.diff
52 (replaceVars ./0002-fix-custom-wallpapers-path.diff {
53 inherit coreutils;
54 })
55 (replaceVars ./0003-aviod-use-hardcode-path.diff {
56 inherit dbus;
57 })
58 ];
59
60 postPatch = ''
61 substituteInPlace session/eventlog/{app_event.go,login_event.go} \
62 --replace-fail "/bin/bash" "${runtimeShell}"
63
64 substituteInPlace inputdevices/layout_list.go \
65 --replace-fail "/usr/share/X11/xkb" "${xkeyboard_config}/share/X11/xkb"
66
67 substituteInPlace accounts1/user.go \
68 --replace-fail "/usr/share/wallpapers" "/run/current-system/sw/share/wallpapers"
69
70 substituteInPlace timedate1/zoneinfo/zone.go \
71 --replace-fail "/usr/share/dde" "$out/share/dde" \
72 --replace-fail "/usr/share/zoneinfo" "${tzdata}/share/zoneinfo"
73
74 substituteInPlace accounts1/image_blur.go grub2/modify_manger.go \
75 --replace-fail "/usr/lib/deepin-api" "/run/current-system/sw/lib/deepin-api"
76
77 substituteInPlace accounts1/user_chpwd_union_id.go \
78 --replace-fail "/usr/lib/dde-control-center" "/run/current-system/sw/lib/dde-control-center"
79
80 substituteInPlace system/uadp1/crypto.go \
81 --replace-fail "/usr/share/uadp" "/var/lib/dde-daemon/uadp"
82
83 for file in $(grep "/usr/lib/deepin-daemon" * -nR |awk -F: '{print $1}')
84 do
85 sed -i 's|/usr/lib/deepin-daemon|/run/current-system/sw/lib/deepin-daemon|g' $file
86 done
87
88 patchShebangs .
89 '';
90
91 nativeBuildInputs = [
92 pkg-config
93 deepin-gettext-tools
94 gettext
95 python3
96 wrapGAppsHook3
97 udevCheckHook
98 ];
99
100 buildInputs = [
101 ddcutil
102 linux-pam
103 libxcrypt
104 alsa-lib
105 glib
106 libgudev
107 gtk3
108 gdk-pixbuf-xlib
109 networkmanager
110 libinput
111 libnl
112 librsvg
113 pulseaudio
114 tzdata
115 xkeyboard_config
116 ];
117
118 buildPhase = ''
119 runHook preBuild
120 make GOBUILD_OPTIONS="$GOFLAGS"
121 runHook postBuild
122 '';
123
124 installPhase = ''
125 runHook preInstall
126 make install DESTDIR="$out" PREFIX="/"
127 runHook postInstall
128 '';
129
130 doCheck = false;
131
132 doInstallCheck = true;
133
134 preFixup = ''
135 gappsWrapperArgs+=(
136 --prefix PATH : "${
137 lib.makeBinPath [
138 util-linux
139 dde-session-ui
140 glib
141 lshw
142 dmidecode
143 systemd
144 ]
145 }"
146 )
147 '';
148
149 postFixup = ''
150 for binary in $out/lib/deepin-daemon/*; do
151 if [ "$binary" == "$out/lib/deepin-daemon/service-trigger" ] ; then
152 continue;
153 fi
154 wrapGApp $binary
155 done
156 '';
157
158 meta = with lib; {
159 description = "Daemon for handling the deepin session settings";
160 homepage = "https://github.com/linuxdeepin/dde-daemon";
161 license = licenses.gpl3Plus;
162 platforms = platforms.linux;
163 teams = [ teams.deepin ];
164 };
165}