From 0f47936e80ceaeffa1d9ea59241410c7621591cb Mon Sep 17 00:00:00 2001 From: Infinidoge Date: Fri, 11 Feb 2022 09:10:30 -0500 Subject: [PATCH] discord: set meta.mainProgram to binaryName Additionally, pull out repetitive pieces of the `packages` definition. --- .../instant-messengers/discord/default.nix | 42 ++++++++++--------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/pkgs/applications/networking/instant-messengers/discord/default.nix b/pkgs/applications/networking/instant-messengers/discord/default.nix index 0672cb72425e..033d7927d42f 100644 --- a/pkgs/applications/networking/instant-messengers/discord/default.nix +++ b/pkgs/applications/networking/instant-messengers/discord/default.nix @@ -61,24 +61,26 @@ let ++ lib.optionals (branch == "ptb") [ "aarch64-darwin" ]; }; package = if stdenv.isLinux then ./linux.nix else ./darwin.nix; - packages = { - stable = callPackage package rec { - inherit src version meta; - pname = "discord"; - binaryName = "Discord"; - desktopName = "Discord"; - }; - ptb = callPackage package rec { - inherit src version meta; - pname = "discord-ptb"; - binaryName = "DiscordPTB"; - desktopName = "Discord PTB"; - }; - canary = callPackage package rec { - inherit src version meta; - pname = "discord-canary"; - binaryName = "DiscordCanary"; - desktopName = "Discord Canary"; - }; - }; + packages = (builtins.mapAttrs + (_: value: callPackage package (value // { inherit src version; meta = meta // { mainProgram = value.binaryName; }; })) + { + stable = rec { + pname = "discord"; + binaryName = "Discord"; + desktopName = "Discord"; + }; + ptb = rec { + pname = "discord-ptb"; + binaryName = "DiscordPTB"; + desktopName = "Discord PTB"; + }; + canary = rec { + pname = "discord-canary"; + binaryName = "DiscordCanary"; + desktopName = "Discord Canary"; + }; + } + ); + + in packages.${branch}