tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
slack: split by system
Sizhe Zhao
5 months ago
aa64b8a0
5d4509bc
+216
-197
3 changed files
expand all
collapse all
unified
split
pkgs
by-name
sl
slack
darwin.nix
linux.nix
package.nix
+30
pkgs/by-name/sl/slack/darwin.nix
···
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
···
1
+
{
2
+
pname,
3
+
version,
4
+
src,
5
+
passthru,
6
+
meta,
7
+
8
+
stdenvNoCC,
9
+
undmg,
10
+
}:
11
+
stdenvNoCC.mkDerivation {
12
+
inherit
13
+
pname
14
+
version
15
+
src
16
+
passthru
17
+
meta
18
+
;
19
+
20
+
nativeBuildInputs = [ undmg ];
21
+
22
+
sourceRoot = ".";
23
+
24
+
installPhase = ''
25
+
runHook preInstall
26
+
mkdir -p $out/Applications
27
+
cp -a Slack.app $out/Applications
28
+
runHook postInstall
29
+
'';
30
+
}
+154
pkgs/by-name/sl/slack/linux.nix
···
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
···
1
+
{
2
+
pname,
3
+
version,
4
+
src,
5
+
passthru,
6
+
meta,
7
+
8
+
lib,
9
+
stdenv,
10
+
dpkg,
11
+
makeWrapper,
12
+
asar,
13
+
alsa-lib,
14
+
at-spi2-atk,
15
+
at-spi2-core,
16
+
atk,
17
+
cairo,
18
+
cups,
19
+
curl,
20
+
dbus,
21
+
expat,
22
+
fontconfig,
23
+
freetype,
24
+
gdk-pixbuf,
25
+
glib,
26
+
gtk3,
27
+
libGL,
28
+
libappindicator-gtk3,
29
+
libdrm,
30
+
libnotify,
31
+
libpulseaudio,
32
+
libuuid,
33
+
libxcb,
34
+
libxkbcommon,
35
+
libgbm,
36
+
nspr,
37
+
nss,
38
+
pango,
39
+
pipewire,
40
+
systemd,
41
+
wayland,
42
+
xdg-utils,
43
+
xorg,
44
+
}:
45
+
stdenv.mkDerivation rec {
46
+
inherit
47
+
pname
48
+
version
49
+
src
50
+
passthru
51
+
meta
52
+
;
53
+
54
+
rpath =
55
+
lib.makeLibraryPath [
56
+
alsa-lib
57
+
at-spi2-atk
58
+
at-spi2-core
59
+
atk
60
+
cairo
61
+
cups
62
+
curl
63
+
dbus
64
+
expat
65
+
fontconfig
66
+
freetype
67
+
gdk-pixbuf
68
+
glib
69
+
gtk3
70
+
libGL
71
+
libappindicator-gtk3
72
+
libdrm
73
+
libnotify
74
+
libpulseaudio
75
+
libuuid
76
+
libxcb
77
+
libxkbcommon
78
+
libgbm
79
+
nspr
80
+
nss
81
+
pango
82
+
pipewire
83
+
stdenv.cc.cc
84
+
systemd
85
+
wayland
86
+
xorg.libX11
87
+
xorg.libXScrnSaver
88
+
xorg.libXcomposite
89
+
xorg.libXcursor
90
+
xorg.libXdamage
91
+
xorg.libXext
92
+
xorg.libXfixes
93
+
xorg.libXi
94
+
xorg.libXrandr
95
+
xorg.libXrender
96
+
xorg.libXtst
97
+
xorg.libxkbfile
98
+
xorg.libxshmfence
99
+
]
100
+
+ ":${lib.getLib stdenv.cc.cc}/lib64";
101
+
102
+
buildInputs = [
103
+
gtk3 # needed for GSETTINGS_SCHEMAS_PATH
104
+
];
105
+
106
+
nativeBuildInputs = [
107
+
dpkg
108
+
makeWrapper
109
+
asar
110
+
];
111
+
112
+
dontUnpack = true;
113
+
dontBuild = true;
114
+
dontPatchELF = true;
115
+
116
+
installPhase = ''
117
+
runHook preInstall
118
+
119
+
# The deb file contains a setuid binary, so 'dpkg -x' doesn't work here
120
+
dpkg --fsys-tarfile $src | tar --extract
121
+
rm -rf usr/share/lintian
122
+
123
+
mkdir -p $out
124
+
mv usr/* $out
125
+
126
+
# Otherwise it looks "suspicious"
127
+
chmod -R g-w $out
128
+
129
+
for file in $(find $out -type f \( -perm /0111 -o -name \*.so\* \) ); do
130
+
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" "$file" || true
131
+
patchelf --set-rpath ${rpath}:$out/lib/slack $file || true
132
+
done
133
+
134
+
# Replace the broken bin/slack symlink with a startup wrapper.
135
+
# Make xdg-open overrideable at runtime.
136
+
rm $out/bin/slack
137
+
makeWrapper $out/lib/slack/slack $out/bin/slack \
138
+
--prefix XDG_DATA_DIRS : $GSETTINGS_SCHEMAS_PATH \
139
+
--suffix PATH : ${lib.makeBinPath [ xdg-utils ]} \
140
+
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations,WebRTCPipeWireCapturer --enable-wayland-ime=true}}"
141
+
142
+
# Fix the desktop link
143
+
substituteInPlace $out/share/applications/slack.desktop \
144
+
--replace /usr/bin/ $out/bin/ \
145
+
--replace /usr/share/pixmaps/slack.png slack \
146
+
--replace bin/slack "bin/slack -s"
147
+
148
+
# Prevent Un-blacklist pipewire integration to enable screen sharing on wayland.
149
+
# https://github.com/flathub/com.slack.Slack/issues/101#issuecomment-1807073763
150
+
sed -i -e 's/,"WebRTCPipeWireCapturer"/,"LebRTCPipeWireCapturer"/' $out/lib/slack/resources/app.asar
151
+
152
+
runHook postInstall
153
+
'';
154
+
}
+32
-197
pkgs/by-name/sl/slack/package.nix
···
1
{
2
-
lib,
3
-
stdenv,
4
fetchurl,
5
-
dpkg,
6
-
undmg,
7
-
makeWrapper,
8
-
asar,
9
-
alsa-lib,
10
-
at-spi2-atk,
11
-
at-spi2-core,
12
-
atk,
13
-
cairo,
14
-
cups,
15
-
curl,
16
-
dbus,
17
-
expat,
18
-
fontconfig,
19
-
freetype,
20
-
gdk-pixbuf,
21
-
glib,
22
-
gtk3,
23
-
libGL,
24
-
libappindicator-gtk3,
25
-
libdrm,
26
-
libnotify,
27
-
libpulseaudio,
28
-
libuuid,
29
-
libxcb,
30
-
libxkbcommon,
31
-
libxshmfence,
32
-
libgbm,
33
-
nspr,
34
-
nss,
35
-
pango,
36
-
pipewire,
37
-
systemd,
38
-
wayland,
39
-
xdg-utils,
40
-
xorg,
41
}:
42
43
let
44
-
inherit (stdenv.hostPlatform) system;
45
-
throwSystem = throw "slack does not support system: ${system}";
46
47
pname = "slack";
48
···
55
aarch64-darwin-version = "4.45.64";
56
aarch64-darwin-sha256 = "136crd17ybaznp680qb2rl0c8cllkkv21ymf3dck2jhkqbp7v2kj";
57
58
-
version =
59
-
{
60
-
x86_64-darwin = x86_64-darwin-version;
61
-
x86_64-linux = x86_64-linux-version;
62
-
aarch64-darwin = aarch64-darwin-version;
63
-
}
64
-
.${system} or throwSystem;
65
-
66
-
src =
67
let
68
base = "https://downloads.slack-edge.com";
69
in
70
{
71
-
x86_64-darwin = fetchurl {
72
-
url = "${base}/desktop-releases/mac/universal/${version}/Slack-${version}-macOS.dmg";
73
-
sha256 = x86_64-darwin-sha256;
0
0
0
74
};
75
-
x86_64-linux = fetchurl {
76
-
url = "${base}/desktop-releases/linux/x64/${version}/slack-desktop-${version}-amd64.deb";
77
-
sha256 = x86_64-linux-sha256;
0
0
0
78
};
79
-
aarch64-darwin = fetchurl {
80
-
url = "${base}/desktop-releases/mac/arm64/${version}/Slack-${version}-macOS.dmg";
81
-
sha256 = aarch64-darwin-sha256;
0
0
0
82
};
83
-
}
84
-
.${system} or throwSystem;
0
0
0
85
86
meta = {
87
description = "Desktop client for Slack";
···
101
];
102
mainProgram = "slack";
103
};
104
-
105
-
linux = stdenv.mkDerivation rec {
106
-
inherit
107
-
pname
108
-
version
109
-
src
110
-
meta
111
-
;
112
-
113
-
passthru.updateScript = ./update.sh;
114
-
115
-
rpath =
116
-
lib.makeLibraryPath [
117
-
alsa-lib
118
-
at-spi2-atk
119
-
at-spi2-core
120
-
atk
121
-
cairo
122
-
cups
123
-
curl
124
-
dbus
125
-
expat
126
-
fontconfig
127
-
freetype
128
-
gdk-pixbuf
129
-
glib
130
-
gtk3
131
-
libGL
132
-
libappindicator-gtk3
133
-
libdrm
134
-
libnotify
135
-
libpulseaudio
136
-
libuuid
137
-
libxcb
138
-
libxkbcommon
139
-
libgbm
140
-
nspr
141
-
nss
142
-
pango
143
-
pipewire
144
-
stdenv.cc.cc
145
-
systemd
146
-
wayland
147
-
xorg.libX11
148
-
xorg.libXScrnSaver
149
-
xorg.libXcomposite
150
-
xorg.libXcursor
151
-
xorg.libXdamage
152
-
xorg.libXext
153
-
xorg.libXfixes
154
-
xorg.libXi
155
-
xorg.libXrandr
156
-
xorg.libXrender
157
-
xorg.libXtst
158
-
xorg.libxkbfile
159
-
xorg.libxshmfence
160
-
]
161
-
+ ":${lib.getLib stdenv.cc.cc}/lib64";
162
-
163
-
buildInputs = [
164
-
gtk3 # needed for GSETTINGS_SCHEMAS_PATH
165
-
];
166
-
167
-
nativeBuildInputs = [
168
-
dpkg
169
-
makeWrapper
170
-
asar
171
-
];
172
-
173
-
dontUnpack = true;
174
-
dontBuild = true;
175
-
dontPatchELF = true;
176
-
177
-
installPhase = ''
178
-
runHook preInstall
179
-
180
-
# The deb file contains a setuid binary, so 'dpkg -x' doesn't work here
181
-
dpkg --fsys-tarfile $src | tar --extract
182
-
rm -rf usr/share/lintian
183
-
184
-
mkdir -p $out
185
-
mv usr/* $out
186
-
187
-
# Otherwise it looks "suspicious"
188
-
chmod -R g-w $out
189
-
190
-
for file in $(find $out -type f \( -perm /0111 -o -name \*.so\* \) ); do
191
-
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" "$file" || true
192
-
patchelf --set-rpath ${rpath}:$out/lib/slack $file || true
193
-
done
194
-
195
-
# Replace the broken bin/slack symlink with a startup wrapper.
196
-
# Make xdg-open overrideable at runtime.
197
-
rm $out/bin/slack
198
-
makeWrapper $out/lib/slack/slack $out/bin/slack \
199
-
--prefix XDG_DATA_DIRS : $GSETTINGS_SCHEMAS_PATH \
200
-
--suffix PATH : ${lib.makeBinPath [ xdg-utils ]} \
201
-
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations,WebRTCPipeWireCapturer --enable-wayland-ime=true}}"
202
-
203
-
# Fix the desktop link
204
-
substituteInPlace $out/share/applications/slack.desktop \
205
-
--replace /usr/bin/ $out/bin/ \
206
-
--replace /usr/share/pixmaps/slack.png slack \
207
-
--replace bin/slack "bin/slack -s"
208
-
''
209
-
+ lib.optionalString stdenv.hostPlatform.isLinux ''
210
-
# Prevent Un-blacklist pipewire integration to enable screen sharing on wayland.
211
-
# https://github.com/flathub/com.slack.Slack/issues/101#issuecomment-1807073763
212
-
sed -i -e 's/,"WebRTCPipeWireCapturer"/,"LebRTCPipeWireCapturer"/' $out/lib/slack/resources/app.asar
213
-
''
214
-
+ ''
215
-
runHook postInstall
216
-
'';
217
-
};
218
-
219
-
darwin = stdenv.mkDerivation {
220
-
inherit
221
-
pname
222
-
version
223
-
src
224
-
meta
225
-
;
226
-
227
-
passthru.updateScript = ./update.sh;
228
-
229
-
nativeBuildInputs = [ undmg ];
230
-
231
-
sourceRoot = ".";
232
-
233
-
installPhase = ''
234
-
runHook preInstall
235
-
mkdir -p $out/Applications
236
-
cp -a Slack.app $out/Applications
237
-
runHook postInstall
238
-
'';
239
-
};
240
in
241
-
if stdenv.hostPlatform.isDarwin then darwin else linux
0
0
0
···
1
{
2
+
callPackage,
0
3
fetchurl,
4
+
lib,
5
+
stdenvNoCC,
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
6
}:
7
8
let
9
+
inherit (stdenvNoCC.hostPlatform) system;
0
10
11
pname = "slack";
12
···
19
aarch64-darwin-version = "4.45.64";
20
aarch64-darwin-sha256 = "136crd17ybaznp680qb2rl0c8cllkkv21ymf3dck2jhkqbp7v2kj";
21
22
+
sources =
0
0
0
0
0
0
0
0
23
let
24
base = "https://downloads.slack-edge.com";
25
in
26
{
27
+
x86_64-darwin = rec {
28
+
version = x86_64-darwin-version;
29
+
src = fetchurl {
30
+
url = "${base}/desktop-releases/mac/universal/${version}/Slack-${version}-macOS.dmg";
31
+
sha256 = x86_64-darwin-sha256;
32
+
};
33
};
34
+
x86_64-linux = rec {
35
+
version = x86_64-linux-version;
36
+
src = fetchurl {
37
+
url = "${base}/desktop-releases/linux/x64/${version}/slack-desktop-${version}-amd64.deb";
38
+
sha256 = x86_64-linux-sha256;
39
+
};
40
};
41
+
aarch64-darwin = rec {
42
+
version = aarch64-darwin-version;
43
+
src = fetchurl {
44
+
url = "${base}/desktop-releases/mac/arm64/${version}/Slack-${version}-macOS.dmg";
45
+
sha256 = aarch64-darwin-sha256;
46
+
};
47
};
48
+
};
49
+
50
+
passthru = {
51
+
updateScript = ./update.sh;
52
+
};
53
54
meta = {
55
description = "Desktop client for Slack";
···
69
];
70
mainProgram = "slack";
71
};
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
72
in
73
+
callPackage (if stdenvNoCC.hostPlatform.isDarwin then ./darwin.nix else ./linux.nix) {
74
+
inherit pname passthru meta;
75
+
inherit (sources.${system} or (throw "Unsupported system: ${system}")) version src;
76
+
}