1 { lib, stdenv, rustPlatform, fetchFromGitHub, openssl, postgresql, libiconv
2 , Security, protobuf, rustfmt, nixosTests, lemmy-translations }:
4 rustPlatform.buildRustPackage rec {
6 pname = "lemmy-server";
11 echo 'pub const VERSION: &str = "${version}";' > crates/utils/src/version.rs
15 rm -rf crates/utils/translations
16 ln -sf ${lemmy-translations} crates/utils/translations
19 cargoSha256 = "sha256-NPGKXA7S/pk13z9defahDuVAm3u444rLUGa+JhPxkfA=";
21 buildInputs = [ postgresql ]
22 ++ lib.optionals stdenv.isDarwin [ libiconv Security ];
24 # Using OPENSSL_NO_VENDOR is not an option on darwin
25 # As of version 0.10.35 rust-openssl looks for openssl on darwin
26 # with a hardcoded path to /usr/lib/libssl.x.x.x.dylib
27 # https://github.com/sfackler/rust-openssl/blob/master/openssl-sys/build/find_normal.rs#L115
28 OPENSSL_LIB_DIR = "${lib.getLib openssl}/lib";
29 OPENSSL_INCLUDE_DIR = "${openssl.dev}/include";
31 PROTOC = "${protobuf}/bin/protoc";
32 PROTOC_INCLUDE = "${protobuf}/include";
33 nativeBuildInputs = [ protobuf rustfmt ];
35 passthru.tests.lemmy-server = nixosTests.lemmy;
38 description = "🐀 Building a federated alternative to reddit in rust";
39 homepage = "https://join-lemmy.org/";
40 license = licenses.agpl3Only;
41 maintainers = with maintainers; [ happysalada billewanick ];
42 mainProgram = "lemmy_server";