mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-02-16 17:14:00 +00:00
![aleksana](/assets/img/avatar_default.png)
We are migrating packages that meet below requirements: 1. using `callPackage` 2. called path is a directory 3. overriding set is empty (`{ }`) 4. not containing path expressions other than relative path (to makenixpkgs-vet happy) 5. not referenced by nix files outside of the directory, other than`pkgs/top-level/all-packages.nix` 6. not referencing nix files outside of the directory 7. not referencing `default.nix` (since it's changed to `package.nix`) 8. `outPath` doesn't change after migration The tool is here: https://github.com/Aleksanaa/by-name-migrate.
52 lines
1.5 KiB
Nix
52 lines
1.5 KiB
Nix
{ lib, stdenvNoCC, fetchFromGitHub, makeWrapper, curl, jq, coreutils, file }:
|
|
|
|
stdenvNoCC.mkDerivation rec {
|
|
pname = "discord-sh";
|
|
version = "2.0.0";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "ChaoticWeg";
|
|
repo = "discord.sh";
|
|
rev = "v${version}";
|
|
sha256 = "sha256-ZOGhwR9xFzkm+q0Gm8mSXZ9toXG4xGPNwBQMCVanCbY=";
|
|
};
|
|
|
|
# ignore Makefile by disabling buildPhase. Upstream Makefile tries to download
|
|
# binaries from the internet for linting
|
|
dontBuild = true;
|
|
|
|
# discord.sh looks for the .webhook file in the source code directory, which
|
|
# isn't mutable on Nix
|
|
postPatch = ''
|
|
substituteInPlace discord.sh \
|
|
--replace 'thisdir="$(cd "$(dirname "$(readlink -f "''${BASH_SOURCE[0]}")")" && pwd)"' 'thisdir="$(pwd)"'
|
|
'';
|
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
doInstallCheck = true;
|
|
|
|
installCheckPhase = ''
|
|
runHook preCheck
|
|
$out/bin/discord.sh --help
|
|
runHook postCheck
|
|
'';
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
install -Dm555 discord.sh $out/bin/discord.sh
|
|
wrapProgram $out/bin/discord.sh \
|
|
--set PATH "${lib.makeBinPath [ curl jq coreutils file ]}"
|
|
runHook postInstall
|
|
'';
|
|
|
|
meta = with lib; {
|
|
description = "Write-only command-line Discord webhook integration written in 100% Bash script";
|
|
mainProgram = "discord.sh";
|
|
homepage = "https://github.com/ChaoticWeg/discord.sh";
|
|
license = licenses.gpl3;
|
|
platforms = platforms.unix;
|
|
maintainers = with maintainers; [ matthewcroughan ];
|
|
};
|
|
}
|