Winter a19cd4ffb1 Revert "treewide: replace rev with tag"
This reverts commit 65a333600d5c88a98d674f637d092807cfc12253.

This wasn't tested for correctness with something like fodwatch [0],
and should not have been (self-)merged so quickly, especially without
further review.

It also resulted in the breakage of at least one package [1] (and that's
the one we know of and was caught).

A few packages that were updated in between this commit and this revert
were not reverted back to using `rev`, but other than that, this is a
1:1 revert.

[0]: https://codeberg.org/raphaelr/fodwatch
[1]: https://github.com/NixOS/nixpkgs/pull/396904 / 758551e4587d75882aebc21a04bee960418f8ce9
2025-04-08 02:57:25 -04:00

69 lines
1.9 KiB
Nix

{
lib,
buildGoModule,
fetchFromGitHub,
pkg-config,
libsecret,
}:
buildGoModule rec {
pname = "protonmail-bridge";
version = "3.19.0";
src = fetchFromGitHub {
owner = "ProtonMail";
repo = "proton-bridge";
rev = "v${version}";
hash = "sha256-Jx6yzn3QNOVz/VM8dqmTm4Upzz46aNo9d6lvhjLwdL4=";
};
vendorHash = "sha256-S08Vw/dLLVd6zFWmpG8wDVf7LOdSC29qo7pUscYHDyY=";
nativeBuildInputs = [ pkg-config ];
buildInputs = [ libsecret ];
preBuild = ''
patchShebangs ./utils/
(cd ./utils/ && ./credits.sh bridge)
'';
ldflags =
let
constants = "github.com/ProtonMail/proton-bridge/v3/internal/constants";
in
[
"-X ${constants}.Version=${version}"
"-X ${constants}.Revision=${src.rev}"
"-X ${constants}.buildTime=unknown"
"-X ${constants}.FullAppName=ProtonMailBridge" # Should be "Proton Mail Bridge", but quoting doesn't seems to work in nix's ldflags
];
subPackages = [
"cmd/Desktop-Bridge"
];
postInstall = ''
mv $out/bin/Desktop-Bridge $out/bin/protonmail-bridge # The cli is named like that in other distro packages
'';
meta = {
changelog = "https://github.com/ProtonMail/proton-bridge/blob/${src.rev}/Changelog.md";
description = "Use your ProtonMail account with your local e-mail client";
downloadPage = "https://github.com/ProtonMail/proton-bridge/releases";
homepage = "https://github.com/ProtonMail/proton-bridge";
license = lib.licenses.gpl3Plus;
longDescription = ''
An application that runs on your computer in the background and seamlessly encrypts
and decrypts your mail as it enters and leaves your computer.
To work, use secret-service freedesktop.org API (e.g. Gnome keyring) or pass.
'';
mainProgram = "protonmail-bridge";
maintainers = with lib.maintainers; [
mrfreezeex
daniel-fahey
];
};
}