protonmail-bridge: separate builder into new file

This commit is contained in:
xeals 2021-02-01 08:49:40 +11:00
parent b960c361a9
commit 8b290acc50
Signed by: xeals
GPG Key ID: A498C7AF27EC6B5C
2 changed files with 57 additions and 52 deletions

View File

@ -0,0 +1,54 @@
{ lib
, fetchFromGitHub
, buildGoModule
, pkg-config
, libsecret
}:
{ pname
, tags
, ...
}@args:
buildGoModule (lib.recursiveUpdate args rec {
inherit pname;
version = "1.5.6";
src = fetchFromGitHub {
owner = "ProtonMail";
repo = "proton-bridge";
rev = "br-${version}";
sha256 = "1na8min9cmn82lpad58abw6837k303fr09l6cvzswaxs73f231ig";
};
vendorSha256 = "1219xa1347877bfhnid15y6w9s4hf1czbrmll2iha4gpsmg066bb";
nativeBuildInputs = (args.nativeBuildInputs or [ ]) ++ [
pkg-config
];
buildInputs = (args.buildInputs or [ ]) ++ [
libsecret
];
buildFlagsArray =
let
t = "github.com/ProtonMail/proton-bridge/pkg/constants";
in
[
"-tags=${tags}"
''
-ldflags=
-X ${t}.Version=${version}
-X ${t}.Revision=unknown
-X ${t}.BuildDate=unknown
''
];
meta = with lib; {
description = "Integrate ProtonMail paid account with any program that supports IMAP and SMTP";
homepage = "https://protonmail.com";
license = licenses.gpl3;
plaforms = platforms.x86_64;
};
})

View File

@ -10,60 +10,11 @@
, qtbase , qtbase
, qtdoc , qtdoc
}: }:
let let
builder = import ./common.nix {
builder = inherit lib fetchFromGitHub buildGoModule libsecret pkg-config;
{ pname
, tags
, ...
}@args:
buildGoModule (lib.recursiveUpdate args rec {
inherit pname;
version = "1.5.6";
src = fetchFromGitHub {
owner = "ProtonMail";
repo = "proton-bridge";
rev = "br-${version}";
sha256 = "1na8min9cmn82lpad58abw6837k303fr09l6cvzswaxs73f231ig";
}; };
vendorSha256 = "1219xa1347877bfhnid15y6w9s4hf1czbrmll2iha4gpsmg066bb";
nativeBuildInputs = (args.nativeBuildInputs or [ ]) ++ [
pkg-config
];
buildInputs = (args.buildInputs or [ ]) ++ [
libsecret
];
buildFlagsArray =
let
t = "github.com/ProtonMail/proton-bridge/pkg/constants";
in
[
"-tags=${tags}"
''
-ldflags=
-X ${t}.Version=${version}
-X ${t}.Revision=unknown
-X ${t}.BuildDate=unknown
''
];
meta = with lib; {
description = "Integrate ProtonMail paid account with any program that supports IMAP and SMTP";
homepage = "https://protonmail.com";
license = licenses.gpl3;
plaforms = platforms.x86_64;
};
});
in in
{ {
protonmail-bridge = builder (import ./app.nix { inherit qtbase go goModules; }); protonmail-bridge = builder (import ./app.nix { inherit qtbase go goModules; });
protonmail-bridge-headless = builder (import ./headless.nix { }); protonmail-bridge-headless = builder (import ./headless.nix { });