nixpkgs/pkgs/by-name/me/mercure/package.nix
Yueh-Shun Li 91b3db1309 treewide: fix sourceRoot for fetchgit-based src
According to Nixpkgs manual[1] and NixOS 23.11 Release Note[2], the
`sourceRoot` attribute passed to `stdenv.mkDerivation` should be
specified as `"${src.name}"` or `"${src.name}/subdir"` when `src` is
produced using `fetchgit`-based fetchers.

`sourceRoot = "source"` or `sourceRoot = "source/subdir"` is based on
the assumption that the `name` attribute of these pre-unpacked fetchers
are always `"source"`, which is not the case. Expecting constant `name`
also makes the source FODs prone to irrelevent hashes during version
bumps.

[1]: https://nixos.org/manual/nixpkgs/unstable/#var-stdenv-sourceRoot
[2]: https://nixos.org/manual/nixos/stable/release-notes#sec-release-23.11
2024-03-09 07:53:25 +08:00

54 lines
1.2 KiB
Nix

{ lib
, buildGoModule
, fetchFromGitHub
, nix-update-script
, testers
, mercure
}:
buildGoModule rec {
pname = "mercure";
version = "0.15.9";
src = fetchFromGitHub {
owner = "dunglas";
repo = "mercure";
rev = "v${version}";
hash = "sha256-4Y+yZSZrBDLPbQXaOCSKk/EY20Ka8CS4ivUg1TEaqXo=";
};
sourceRoot = "${src.name}/caddy";
vendorHash = "sha256-N0RmvhBlTiWmBb4TzLmaThD9jVkKgcIO9vPWxJAvLRQ=";
subPackages = [ "mercure" ];
excludedPackages = [ "../cmd/mercure" ];
ldflags = [
"-s"
"-w"
"-X 'github.com/caddyserver/caddy/v2.CustomVersion=Mercure.rocks v${version} Caddy'"
];
doCheck = false;
passthru = {
updateScript = nix-update-script { };
tests.version = testers.testVersion {
version = "v${version}";
package = mercure;
command = "mercure version";
};
};
meta = with lib; {
description = "An open, easy, fast, reliable and battery-efficient solution for real-time communications";
homepage = "https://github.com/dunglas/mercure";
changelog = "https://github.com/dunglas/mercure/releases/tag/v${version}";
license = licenses.agpl3Only;
maintainers = with maintainers; [ gaelreyrol ];
platforms = platforms.unix;
mainProgram = "mercure";
};
}