Files
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

107 lines
2.4 KiB
Nix

{
lib,
stdenv,
fetchFromGitHub,
buildGoModule,
cmake,
curl,
go,
unzip,
zip,
catch2,
cxxopts,
fmt,
versionCheckHook,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "protonmail-export";
version = "1.0.5";
src = fetchFromGitHub {
owner = "ProtonMail";
repo = "proton-mail-export";
tag = "v${finalAttrs.version}";
fetchSubmodules = true;
hash = "sha256-rpfTI3vcZlEK1TrxRMMHFKutwC/YqAZrZCFiUsfMafc=";
};
goModules =
(buildGoModule {
pname = "protonmail-export-go-modules";
inherit (finalAttrs) src version;
sourceRoot = "${finalAttrs.src.name}/go-lib";
vendorHash = "sha256-rKi3PNsYsZA+MLcLTVrVI3T2SUBZCiq9Zxtf+1SGArk=";
nativeBuildInputs = [ unzip ];
proxyVendor = true;
}).goModules;
postPatch = ''
echo "" > vcpkg/scripts/buildsystems/vcpkg.cmake
substituteInPlace CMakeLists.txt \
--replace-fail 'include(clang_tidy)' ''' \
--replace-fail 'include(clang_format)' '''
substituteInPlace lib/CMakeLists.txt \
--replace-fail 'add_subdirectory(tests)' '''
substituteInPlace cli/bin/main.cpp --replace-fail \
'execPath = etcpp::getExecutableDir();' 'execPath = std::filesystem::u8path(std::getenv("HOME")) / ".config" / "protonmail-export";'
'';
preConfigure = ''
export GOCACHE=$TMPDIR/go-cache
export GOPATH=$TMPDIR/go
export GOPROXY=file://$goModules
'';
nativeBuildInputs = [
cmake
curl
go
unzip
zip
];
buildInputs = [
fmt
catch2
cxxopts
];
postInstall =
let
so = "proton-mail-export${stdenv.hostPlatform.extensions.library}";
in
''
install -Dm644 $out/bin/${so} -t $out/lib
rm -f $out/bin/${so}
''
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
install_name_tool -change @loader_path/${so} \
$out/lib/${so} \
$out/bin/proton-mail-export-cli
'';
nativeInstallCheckInputs = [
versionCheckHook
];
versionCheckProgram = "${placeholder "out"}/bin/proton-mail-export-cli";
versionCheckProgramArg = "--version";
doInstallCheck = true;
meta = {
description = "Export your Proton Mail emails as eml files";
homepage = "https://github.com/ProtonMail/proton-mail-export";
license = lib.licenses.gpl3Plus;
platforms = lib.platforms.unix;
maintainers = [ lib.maintainers.ryand56 ];
mainProgram = "proton-mail-export-cli";
};
})