Skip to content

Commit

Permalink
add proton-mail-export
Browse files Browse the repository at this point in the history
  • Loading branch information
42LoCo42 committed Dec 29, 2024
1 parent 2965f98 commit dd631db
Show file tree
Hide file tree
Showing 4 changed files with 133 additions and 1 deletion.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ A personal collection of unusual things
* substituter: `https://attic.eleonora.gay/default`
* public key: `default:3FYh8sZV8gWa7Jc5jlP7gZFK7pt3kaHRiV70ySaQ42g=`

## 53 Packages
## 54 Packages

| Name | Version | Description | Homepage |
|------|---------|-------------|----------|
Expand Down Expand Up @@ -48,6 +48,7 @@ A personal collection of unusual things
|`photoview`|`v2.4.0`|Photo gallery for self-hosted personal servers|https://photoview.github.io|
|`pinlist`|`n/a`|Super simple text/link pinlist tool|https://github.com/42LoCo42/pinlist|
|`prettier-plugin-go-template`|`d91c82e`|Fixes prettier formatting for go templates|https://github.com/NiklasPor/prettier-plugin-go-template|
|`proton-mail-export`|`1.0.4`|Proton Mail Export allows you to export your emails as eml files|https://github.com/ProtonMail/proton-mail-export|
|`pug`|`3.0.1`|Pug 3 CLI interface|https://github.com/tokilabs/pug3-cli|
|`redis-json`|`2.6.8`|RedisJSON - a JSON data type for Redis|https://github.com/RedisJSON/RedisJSON|
|`rom-parser`|`2017-03-31`|Parse & change GPU VBIOS files|https://github.com/awilliam/rom-parser|
Expand Down
22 changes: 22 additions & 0 deletions packages/proton-mail-export/0001-cmake-disable-vcpkg.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
From 724d6bb0b58be2c8aaffd4f6250f6c071f0aa9cb Mon Sep 17 00:00:00 2001
From: Leon Schumacher <[email protected]>
Date: Sun, 29 Dec 2024 18:18:36 +0100
Subject: [PATCH 1/2] cmake: disable vcpkg

---
CMakeLists.txt | 1 -
1 file changed, 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 90b2343..2221314 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,5 +1,4 @@
include(cmake/mingw.cmake)
-include(cmake/vcpkg_setup.cmake)
cmake_minimum_required(VERSION 3.23)
project(ExportTool CXX C)

--
2.47.0

Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
From 95ee52657a7b0861d6ce830a57089625f5ee33f1 Mon Sep 17 00:00:00 2001
From: Leon Schumacher <[email protected]>
Date: Sun, 29 Dec 2024 19:28:56 +0100
Subject: [PATCH 2/2] dont write logs in exe directory

---
cli/bin/main.cpp | 16 ++--------------
1 file changed, 2 insertions(+), 14 deletions(-)

diff --git a/cli/bin/main.cpp b/cli/bin/main.cpp
index 4bd6124..17d74f2 100644
--- a/cli/bin/main.cpp
+++ b/cli/bin/main.cpp
@@ -261,19 +261,7 @@ public:
};

std::filesystem::path getOutputPath() {
-#if !defined(__APPLE__)
- std::filesystem::path execPath;
- try {
- execPath = etcpp::getExecutableDir();
- } catch (const std::exception& e) {
- std::cerr << "Failed to get executable directory: " << e.what() << std::endl;
- std::cerr << "Will user working directory instead" << std::endl;
- }
-
- return execPath;
-#else
- return getMacOSDownloadsDir() / "proton-mail-export-cli";
-#endif
+ return std::filesystem::current_path();
}


@@ -745,4 +733,4 @@ int main(int argc, const char** argv) {
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
-}
\ No newline at end of file
+}
--
2.47.0

65 changes: 65 additions & 0 deletions packages/proton-mail-export/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
pkgs:
let
pname = "proton-mail-export";
version = "1.0.4";

src = pkgs.fetchFromGitHub {
owner = "ProtonMail";
repo = pname;
rev = "v${version}";
hash = "sha256-AbIS7iB5y1+vOfvAgw8mRNRTvuzdE2ML6Izod+BMCUE=";
};

inherit (pkgs.buildGoModule {
inherit pname version;
src = "${src}/go-lib";
vendorHash = "sha256-0JsJO5E9Y7DpuZfWHFpqZKO8PPsCokl+YS5zs+zLt30=";
}) goModules;
in
pkgs.stdenv.mkDerivation {
inherit pname version src;

patches = [
./0001-cmake-disable-vcpkg.patch
./0002-dont-write-logs-in-exe-directory.patch
];

nativeBuildInputs = with pkgs; [
clang-tools # clang-tidy
cmake
go
ninja
];

buildInputs = with pkgs; [
catch2_3
cxxopts
fmt
];

preConfigure = ''
export GOCACHE=$TMPDIR/go-cache
export GOPATH="$TMPDIR/go"
export GOPROXY=off
export GOSUMDB=off
cp -r --reflink=auto "${goModules}" go-lib/vendor
'';

postInstall = ''
cd $out
# meta only includes version.json, which we don't need
rm -rf $out/meta
# for some reason, the library is installed into bin
mkdir lib
mv {bin,lib}/${pname}.so
'';

meta = {
description = "Proton Mail Export allows you to export your emails as eml files";
homepage = "https://github.com/ProtonMail/proton-mail-export";
mainProgram = "${pname}-cli";
};
}

0 comments on commit dd631db

Please sign in to comment.