mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-27 09:23:01 +00:00
discord: format {darwin,default,linux}.nix files with nixfmt-rfc-style
(cherry picked from commit 84e88c59ee
)
This commit is contained in:
parent
2b3d382131
commit
b12847e710
@ -1,25 +1,51 @@
|
||||
{ pname, version, src, meta, stdenv, binaryName, desktopName, lib, undmg, makeWrapper, writeScript, python3, runCommand
|
||||
, branch
|
||||
, withOpenASAR ? false, openasar
|
||||
, withVencord ? false, vencord }:
|
||||
{
|
||||
pname,
|
||||
version,
|
||||
src,
|
||||
meta,
|
||||
stdenv,
|
||||
binaryName,
|
||||
desktopName,
|
||||
lib,
|
||||
undmg,
|
||||
makeWrapper,
|
||||
writeScript,
|
||||
python3,
|
||||
runCommand,
|
||||
branch,
|
||||
withOpenASAR ? false,
|
||||
openasar,
|
||||
withVencord ? false,
|
||||
vencord,
|
||||
}:
|
||||
|
||||
let
|
||||
disableBreakingUpdates = runCommand "disable-breaking-updates.py"
|
||||
{
|
||||
pythonInterpreter = "${python3.interpreter}";
|
||||
configDirName = lib.toLower binaryName;
|
||||
meta.mainProgram = "disable-breaking-updates.py";
|
||||
} ''
|
||||
mkdir -p $out/bin
|
||||
cp ${./disable-breaking-updates.py} $out/bin/disable-breaking-updates.py
|
||||
substituteAllInPlace $out/bin/disable-breaking-updates.py
|
||||
chmod +x $out/bin/disable-breaking-updates.py
|
||||
'';
|
||||
disableBreakingUpdates =
|
||||
runCommand "disable-breaking-updates.py"
|
||||
{
|
||||
pythonInterpreter = "${python3.interpreter}";
|
||||
configDirName = lib.toLower binaryName;
|
||||
meta.mainProgram = "disable-breaking-updates.py";
|
||||
}
|
||||
''
|
||||
mkdir -p $out/bin
|
||||
cp ${./disable-breaking-updates.py} $out/bin/disable-breaking-updates.py
|
||||
substituteAllInPlace $out/bin/disable-breaking-updates.py
|
||||
chmod +x $out/bin/disable-breaking-updates.py
|
||||
'';
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
inherit pname version src meta;
|
||||
inherit
|
||||
pname
|
||||
version
|
||||
src
|
||||
meta
|
||||
;
|
||||
|
||||
nativeBuildInputs = [ undmg makeWrapper ];
|
||||
nativeBuildInputs = [
|
||||
undmg
|
||||
makeWrapper
|
||||
];
|
||||
|
||||
sourceRoot = ".";
|
||||
|
||||
@ -37,14 +63,16 @@ stdenv.mkDerivation {
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
postInstall = lib.strings.optionalString withOpenASAR ''
|
||||
cp -f ${openasar} $out/Applications/${desktopName}.app/Contents/Resources/app.asar
|
||||
'' + lib.strings.optionalString withVencord ''
|
||||
mv $out/Applications/${desktopName}.app/Contents/Resources/app.asar $out/Applications/${desktopName}.app/Contents/Resources/_app.asar
|
||||
mkdir $out/Applications/${desktopName}.app/Contents/Resources/app.asar
|
||||
echo '{"name":"discord","main":"index.js"}' > $out/Applications/${desktopName}.app/Contents/Resources/app.asar/package.json
|
||||
echo 'require("${vencord}/patcher.js")' > $out/Applications/${desktopName}.app/Contents/Resources/app.asar/index.js
|
||||
'';
|
||||
postInstall =
|
||||
lib.strings.optionalString withOpenASAR ''
|
||||
cp -f ${openasar} $out/Applications/${desktopName}.app/Contents/Resources/app.asar
|
||||
''
|
||||
+ lib.strings.optionalString withVencord ''
|
||||
mv $out/Applications/${desktopName}.app/Contents/Resources/app.asar $out/Applications/${desktopName}.app/Contents/Resources/_app.asar
|
||||
mkdir $out/Applications/${desktopName}.app/Contents/Resources/app.asar
|
||||
echo '{"name":"discord","main":"index.js"}' > $out/Applications/${desktopName}.app/Contents/Resources/app.asar/package.json
|
||||
echo 'require("${vencord}/patcher.js")' > $out/Applications/${desktopName}.app/Contents/Resources/app.asar/index.js
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
# make it possible to run disableBreakingUpdates standalone
|
||||
@ -56,7 +84,9 @@ stdenv.mkDerivation {
|
||||
set -eou pipefail;
|
||||
url=$(curl -sI -o /dev/null -w '%header{location}' "https://discord.com/api/download/${branch}?platform=osx&format=dmg")
|
||||
version=$(echo $url | grep -oP '/\K(\d+\.){2}\d+')
|
||||
update-source-version ${lib.optionalString (!stdenv.buildPlatform.isDarwin) "pkgsCross.aarch64-darwin."}${pname} "$version" --file=./pkgs/applications/networking/instant-messengers/discord/default.nix --version-key=${branch}
|
||||
update-source-version ${
|
||||
lib.optionalString (!stdenv.buildPlatform.isDarwin) "pkgsCross.aarch64-darwin."
|
||||
}${pname} "$version" --file=./pkgs/applications/networking/instant-messengers/discord/default.nix --version-key=${branch}
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
@ -1,17 +1,26 @@
|
||||
{ branch ? "stable", callPackage, fetchurl, lib, stdenv }:
|
||||
{
|
||||
branch ? "stable",
|
||||
callPackage,
|
||||
fetchurl,
|
||||
lib,
|
||||
stdenv,
|
||||
}:
|
||||
let
|
||||
versions =
|
||||
if stdenv.hostPlatform.isLinux then {
|
||||
stable = "0.0.71";
|
||||
ptb = "0.0.110";
|
||||
canary = "0.0.502";
|
||||
development = "0.0.30";
|
||||
} else {
|
||||
stable = "0.0.322";
|
||||
ptb = "0.0.140";
|
||||
canary = "0.0.611";
|
||||
development = "0.0.53";
|
||||
};
|
||||
if stdenv.hostPlatform.isLinux then
|
||||
{
|
||||
stable = "0.0.71";
|
||||
ptb = "0.0.110";
|
||||
canary = "0.0.502";
|
||||
development = "0.0.30";
|
||||
}
|
||||
else
|
||||
{
|
||||
stable = "0.0.322";
|
||||
ptb = "0.0.140";
|
||||
canary = "0.0.611";
|
||||
development = "0.0.53";
|
||||
};
|
||||
version = versions.${branch};
|
||||
srcs = rec {
|
||||
x86_64-linux = {
|
||||
@ -52,7 +61,9 @@ let
|
||||
};
|
||||
aarch64-darwin = x86_64-darwin;
|
||||
};
|
||||
src = srcs.${stdenv.hostPlatform.system}.${branch} or (throw "${stdenv.hostPlatform.system} not supported on ${branch}");
|
||||
src =
|
||||
srcs.${stdenv.hostPlatform.system}.${branch}
|
||||
or (throw "${stdenv.hostPlatform.system} not supported on ${branch}");
|
||||
|
||||
meta = with lib; {
|
||||
description = "All-in-one cross-platform voice and text chat for gamers";
|
||||
@ -60,23 +71,35 @@ let
|
||||
downloadPage = "https://discordapp.com/download";
|
||||
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
|
||||
license = licenses.unfree;
|
||||
maintainers = with maintainers; [ Scrumplex artturin infinidoge jopejoe1 ];
|
||||
platforms = [ "x86_64-linux" "x86_64-darwin" "aarch64-darwin" ];
|
||||
maintainers = with maintainers; [
|
||||
Scrumplex
|
||||
artturin
|
||||
infinidoge
|
||||
jopejoe1
|
||||
];
|
||||
platforms = [
|
||||
"x86_64-linux"
|
||||
"x86_64-darwin"
|
||||
"aarch64-darwin"
|
||||
];
|
||||
mainProgram = "discord";
|
||||
};
|
||||
package =
|
||||
if stdenv.isLinux
|
||||
then ./linux.nix
|
||||
else ./darwin.nix;
|
||||
package = if stdenv.hostPlatform.isLinux then ./linux.nix else ./darwin.nix;
|
||||
|
||||
packages = (
|
||||
builtins.mapAttrs
|
||||
(_: value:
|
||||
callPackage package (value
|
||||
(
|
||||
_: value:
|
||||
callPackage package (
|
||||
value
|
||||
// {
|
||||
inherit src version branch;
|
||||
meta = meta // { mainProgram = value.binaryName; };
|
||||
}))
|
||||
inherit src version branch;
|
||||
meta = meta // {
|
||||
mainProgram = value.binaryName;
|
||||
};
|
||||
}
|
||||
)
|
||||
)
|
||||
{
|
||||
stable = {
|
||||
pname = "discord";
|
||||
|
@ -1,34 +1,92 @@
|
||||
{ pname, version, src, meta, binaryName, desktopName, autoPatchelfHook
|
||||
, makeDesktopItem, lib, stdenv, wrapGAppsHook3, makeShellWrapper, alsa-lib, at-spi2-atk
|
||||
, at-spi2-core, atk, cairo, cups, dbus, expat, fontconfig, freetype, gdk-pixbuf
|
||||
, glib, gtk3, libcxx, libdrm, libglvnd, libnotify, libpulseaudio, libuuid, libX11
|
||||
, libXScrnSaver, libXcomposite, libXcursor, libXdamage, libXext, libXfixes
|
||||
, libXi, libXrandr, libXrender, libXtst, libxcb, libxshmfence, mesa, nspr, nss
|
||||
, pango, systemd, libappindicator-gtk3, libdbusmenu, writeScript, python3, runCommand
|
||||
, libunity
|
||||
, speechd
|
||||
, wayland
|
||||
, branch
|
||||
, withOpenASAR ? false, openasar
|
||||
, withVencord ? false, vencord
|
||||
, withTTS ? true }:
|
||||
{
|
||||
pname,
|
||||
version,
|
||||
src,
|
||||
meta,
|
||||
binaryName,
|
||||
desktopName,
|
||||
autoPatchelfHook,
|
||||
makeDesktopItem,
|
||||
lib,
|
||||
stdenv,
|
||||
wrapGAppsHook3,
|
||||
makeShellWrapper,
|
||||
alsa-lib,
|
||||
at-spi2-atk,
|
||||
at-spi2-core,
|
||||
atk,
|
||||
cairo,
|
||||
cups,
|
||||
dbus,
|
||||
expat,
|
||||
fontconfig,
|
||||
freetype,
|
||||
gdk-pixbuf,
|
||||
glib,
|
||||
gtk3,
|
||||
libcxx,
|
||||
libdrm,
|
||||
libglvnd,
|
||||
libnotify,
|
||||
libpulseaudio,
|
||||
libuuid,
|
||||
libX11,
|
||||
libXScrnSaver,
|
||||
libXcomposite,
|
||||
libXcursor,
|
||||
libXdamage,
|
||||
libXext,
|
||||
libXfixes,
|
||||
libXi,
|
||||
libXrandr,
|
||||
libXrender,
|
||||
libXtst,
|
||||
libxcb,
|
||||
libxshmfence,
|
||||
mesa,
|
||||
nspr,
|
||||
nss,
|
||||
pango,
|
||||
systemd,
|
||||
libappindicator-gtk3,
|
||||
libdbusmenu,
|
||||
writeScript,
|
||||
python3,
|
||||
runCommand,
|
||||
libunity,
|
||||
speechd,
|
||||
wayland,
|
||||
branch,
|
||||
withOpenASAR ? false,
|
||||
openasar,
|
||||
withVencord ? false,
|
||||
vencord,
|
||||
withTTS ? true,
|
||||
}:
|
||||
|
||||
let
|
||||
disableBreakingUpdates = runCommand "disable-breaking-updates.py"
|
||||
{
|
||||
pythonInterpreter = "${python3.interpreter}";
|
||||
configDirName = lib.toLower binaryName;
|
||||
meta.mainProgram = "disable-breaking-updates.py";
|
||||
} ''
|
||||
mkdir -p $out/bin
|
||||
cp ${./disable-breaking-updates.py} $out/bin/disable-breaking-updates.py
|
||||
substituteAllInPlace $out/bin/disable-breaking-updates.py
|
||||
chmod +x $out/bin/disable-breaking-updates.py
|
||||
'';
|
||||
disableBreakingUpdates =
|
||||
runCommand "disable-breaking-updates.py"
|
||||
{
|
||||
pythonInterpreter = "${python3.interpreter}";
|
||||
configDirName = lib.toLower binaryName;
|
||||
meta.mainProgram = "disable-breaking-updates.py";
|
||||
}
|
||||
''
|
||||
mkdir -p $out/bin
|
||||
cp ${./disable-breaking-updates.py} $out/bin/disable-breaking-updates.py
|
||||
substituteAllInPlace $out/bin/disable-breaking-updates.py
|
||||
chmod +x $out/bin/disable-breaking-updates.py
|
||||
'';
|
||||
in
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
inherit pname version src meta;
|
||||
inherit
|
||||
pname
|
||||
version
|
||||
src
|
||||
meta
|
||||
;
|
||||
|
||||
nativeBuildInputs = [
|
||||
alsa-lib
|
||||
@ -50,48 +108,51 @@ stdenv.mkDerivation rec {
|
||||
|
||||
dontWrapGApps = true;
|
||||
|
||||
libPath = lib.makeLibraryPath ([
|
||||
libcxx
|
||||
systemd
|
||||
libpulseaudio
|
||||
libdrm
|
||||
mesa
|
||||
stdenv.cc.cc
|
||||
alsa-lib
|
||||
atk
|
||||
at-spi2-atk
|
||||
at-spi2-core
|
||||
cairo
|
||||
cups
|
||||
dbus
|
||||
expat
|
||||
fontconfig
|
||||
freetype
|
||||
gdk-pixbuf
|
||||
glib
|
||||
gtk3
|
||||
libglvnd
|
||||
libnotify
|
||||
libX11
|
||||
libXcomposite
|
||||
libunity
|
||||
libuuid
|
||||
libXcursor
|
||||
libXdamage
|
||||
libXext
|
||||
libXfixes
|
||||
libXi
|
||||
libXrandr
|
||||
libXrender
|
||||
libXtst
|
||||
nspr
|
||||
libxcb
|
||||
pango
|
||||
libXScrnSaver
|
||||
libappindicator-gtk3
|
||||
libdbusmenu
|
||||
wayland
|
||||
] ++ lib.optional withTTS speechd);
|
||||
libPath = lib.makeLibraryPath (
|
||||
[
|
||||
libcxx
|
||||
systemd
|
||||
libpulseaudio
|
||||
libdrm
|
||||
mesa
|
||||
stdenv.cc.cc
|
||||
alsa-lib
|
||||
atk
|
||||
at-spi2-atk
|
||||
at-spi2-core
|
||||
cairo
|
||||
cups
|
||||
dbus
|
||||
expat
|
||||
fontconfig
|
||||
freetype
|
||||
gdk-pixbuf
|
||||
glib
|
||||
gtk3
|
||||
libglvnd
|
||||
libnotify
|
||||
libX11
|
||||
libXcomposite
|
||||
libunity
|
||||
libuuid
|
||||
libXcursor
|
||||
libXdamage
|
||||
libXext
|
||||
libXfixes
|
||||
libXi
|
||||
libXrandr
|
||||
libXrender
|
||||
libXtst
|
||||
nspr
|
||||
libxcb
|
||||
pango
|
||||
libXScrnSaver
|
||||
libappindicator-gtk3
|
||||
libdbusmenu
|
||||
wayland
|
||||
]
|
||||
++ lib.optional withTTS speechd
|
||||
);
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
@ -113,9 +174,7 @@ stdenv.mkDerivation rec {
|
||||
|
||||
ln -s $out/opt/${binaryName}/${binaryName} $out/bin/
|
||||
# Without || true the install would fail on case-insensitive filesystems
|
||||
ln -s $out/opt/${binaryName}/${binaryName} $out/bin/${
|
||||
lib.strings.toLower binaryName
|
||||
} || true
|
||||
ln -s $out/opt/${binaryName}/${binaryName} $out/bin/${lib.strings.toLower binaryName} || true
|
||||
|
||||
ln -s $out/opt/${binaryName}/discord.png $out/share/pixmaps/${pname}.png
|
||||
ln -s $out/opt/${binaryName}/discord.png $out/share/icons/hicolor/256x256/apps/${pname}.png
|
||||
@ -125,14 +184,16 @@ stdenv.mkDerivation rec {
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
postInstall = lib.strings.optionalString withOpenASAR ''
|
||||
cp -f ${openasar} $out/opt/${binaryName}/resources/app.asar
|
||||
'' + lib.strings.optionalString withVencord ''
|
||||
mv $out/opt/${binaryName}/resources/app.asar $out/opt/${binaryName}/resources/_app.asar
|
||||
mkdir $out/opt/${binaryName}/resources/app.asar
|
||||
echo '{"name":"discord","main":"index.js"}' > $out/opt/${binaryName}/resources/app.asar/package.json
|
||||
echo 'require("${vencord}/patcher.js")' > $out/opt/${binaryName}/resources/app.asar/index.js
|
||||
'';
|
||||
postInstall =
|
||||
lib.strings.optionalString withOpenASAR ''
|
||||
cp -f ${openasar} $out/opt/${binaryName}/resources/app.asar
|
||||
''
|
||||
+ lib.strings.optionalString withVencord ''
|
||||
mv $out/opt/${binaryName}/resources/app.asar $out/opt/${binaryName}/resources/_app.asar
|
||||
mkdir $out/opt/${binaryName}/resources/app.asar
|
||||
echo '{"name":"discord","main":"index.js"}' > $out/opt/${binaryName}/resources/app.asar/package.json
|
||||
echo 'require("${vencord}/patcher.js")' > $out/opt/${binaryName}/resources/app.asar/index.js
|
||||
'';
|
||||
|
||||
desktopItem = makeDesktopItem {
|
||||
name = pname;
|
||||
@ -140,7 +201,10 @@ stdenv.mkDerivation rec {
|
||||
icon = pname;
|
||||
inherit desktopName;
|
||||
genericName = meta.description;
|
||||
categories = [ "Network" "InstantMessaging" ];
|
||||
categories = [
|
||||
"Network"
|
||||
"InstantMessaging"
|
||||
];
|
||||
mimeTypes = [ "x-scheme-handler/discord" ];
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user