1 { lib, stdenv, rustPlatform, fetchFromGitHub, openssl, postgresql, libiconv
2 , Security, protobuf, rustfmt, nixosTests }:
4 pinData = lib.importJSON ./pin.json;
5 version = pinData.serverVersion;
6 in rustPlatform.buildRustPackage rec {
8 pname = "lemmy-server";
10 src = fetchFromGitHub {
14 sha256 = pinData.serverSha256;
15 fetchSubmodules = true;
19 echo 'pub const VERSION: &str = "${version}";' > crates/utils/src/version.rs
22 cargoSha256 = pinData.serverCargoSha256;
24 buildInputs = [ postgresql ]
25 ++ lib.optionals stdenv.isDarwin [ libiconv Security ];
27 # Using OPENSSL_NO_VENDOR is not an option on darwin
28 # As of version 0.10.35 rust-openssl looks for openssl on darwin
29 # with a hardcoded path to /usr/lib/libssl.x.x.x.dylib
30 # https://github.com/sfackler/rust-openssl/blob/master/openssl-sys/build/find_normal.rs#L115
31 OPENSSL_LIB_DIR = "${lib.getLib openssl}/lib";
32 OPENSSL_INCLUDE_DIR = "${openssl.dev}/include";
34 PROTOC = "${protobuf}/bin/protoc";
35 PROTOC_INCLUDE = "${protobuf}/include";
36 nativeBuildInputs = [ protobuf rustfmt ];
38 passthru.updateScript = ./update.py;
39 passthru.tests.lemmy-server = nixosTests.lemmy;
42 doInstallCheck = false;
45 description = "🐀 Building a federated alternative to reddit in rust";
46 homepage = "https://join-lemmy.org/";
47 license = licenses.agpl3Only;
48 maintainers = with maintainers; [ happysalada billewanick ];
49 mainProgram = "lemmy_server";