2021-07-14 22:03:04 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, rustPlatform
|
|
|
|
, fetchFromGitHub
|
|
|
|
, openssl
|
|
|
|
, postgresql
|
|
|
|
, libiconv
|
|
|
|
, Security
|
2022-01-19 23:45:15 +00:00
|
|
|
, protobuf
|
2022-06-26 10:26:21 +00:00
|
|
|
, rustfmt
|
2021-07-14 22:03:04 +00:00
|
|
|
}:
|
2021-12-06 16:07:01 +00:00
|
|
|
let
|
|
|
|
pinData = lib.importJSON ./pin.json;
|
|
|
|
version = pinData.version;
|
|
|
|
in
|
2021-07-14 22:03:04 +00:00
|
|
|
rustPlatform.buildRustPackage rec {
|
2021-12-06 16:07:01 +00:00
|
|
|
inherit version;
|
2021-07-14 22:03:04 +00:00
|
|
|
pname = "lemmy-server";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "LemmyNet";
|
|
|
|
repo = "lemmy";
|
|
|
|
rev = version;
|
2021-12-06 16:07:01 +00:00
|
|
|
sha256 = pinData.serverSha256;
|
2022-06-26 10:26:21 +00:00
|
|
|
fetchSubmodules = true;
|
2021-07-14 22:03:04 +00:00
|
|
|
};
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
cargoSha256 = pinData.serverCargoSha256;
|
2021-07-14 22:03:04 +00:00
|
|
|
|
|
|
|
buildInputs = [ postgresql ]
|
|
|
|
++ lib.optionals stdenv.isDarwin [ libiconv Security ];
|
|
|
|
|
|
|
|
# Using OPENSSL_NO_VENDOR is not an option on darwin
|
|
|
|
# As of version 0.10.35 rust-openssl looks for openssl on darwin
|
|
|
|
# with a hardcoded path to /usr/lib/libssl.x.x.x.dylib
|
|
|
|
# https://github.com/sfackler/rust-openssl/blob/master/openssl-sys/build/find_normal.rs#L115
|
2022-04-03 18:54:34 +00:00
|
|
|
OPENSSL_LIB_DIR = "${lib.getLib openssl}/lib";
|
2021-07-14 22:03:04 +00:00
|
|
|
OPENSSL_INCLUDE_DIR = "${openssl.dev}/include";
|
|
|
|
|
2022-01-19 23:45:15 +00:00
|
|
|
PROTOC = "${protobuf}/bin/protoc";
|
|
|
|
PROTOC_INCLUDE = "${protobuf}/include";
|
2022-06-26 10:26:21 +00:00
|
|
|
nativeBuildInputs = [ protobuf rustfmt ];
|
2022-01-19 23:45:15 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
passthru.updateScript = ./update.sh;
|
|
|
|
|
2021-07-14 22:03:04 +00:00
|
|
|
meta = with lib; {
|
2021-09-18 10:52:07 +00:00
|
|
|
description = "🐀 Building a federated alternative to reddit in rust";
|
2021-07-14 22:03:04 +00:00
|
|
|
homepage = "https://join-lemmy.org/";
|
|
|
|
license = licenses.agpl3Only;
|
|
|
|
maintainers = with maintainers; [ happysalada ];
|
2022-05-18 14:49:53 +00:00
|
|
|
mainProgram = "lemmy_server";
|
2021-07-14 22:03:04 +00:00
|
|
|
};
|
|
|
|
}
|