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