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