Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib 2, stdenv 3, rustPlatform 4, fetchFromGitHub 5, openssl 6, postgresql 7, libiconv 8, Security 9, protobuf 10, rustfmt 11, nixosTests 12}: 13let 14 pinData = lib.importJSON ./pin.json; 15 version = pinData.version; 16in 17rustPlatform.buildRustPackage rec { 18 inherit version; 19 pname = "lemmy-server"; 20 21 src = fetchFromGitHub { 22 owner = "LemmyNet"; 23 repo = "lemmy"; 24 rev = version; 25 sha256 = pinData.serverSha256; 26 fetchSubmodules = true; 27 }; 28 29 cargoSha256 = pinData.serverCargoSha256; 30 31 buildInputs = [ postgresql ] 32 ++ lib.optionals stdenv.isDarwin [ libiconv Security ]; 33 34 # Using OPENSSL_NO_VENDOR is not an option on darwin 35 # As of version 0.10.35 rust-openssl looks for openssl on darwin 36 # with a hardcoded path to /usr/lib/libssl.x.x.x.dylib 37 # https://github.com/sfackler/rust-openssl/blob/master/openssl-sys/build/find_normal.rs#L115 38 OPENSSL_LIB_DIR = "${lib.getLib openssl}/lib"; 39 OPENSSL_INCLUDE_DIR = "${openssl.dev}/include"; 40 41 PROTOC = "${protobuf}/bin/protoc"; 42 PROTOC_INCLUDE = "${protobuf}/include"; 43 nativeBuildInputs = [ protobuf rustfmt ]; 44 45 passthru.updateScript = ./update.sh; 46 passthru.tests.lemmy-server = nixosTests.lemmy; 47 48 meta = with lib; { 49 description = "🐀 Building a federated alternative to reddit in rust"; 50 homepage = "https://join-lemmy.org/"; 51 license = licenses.agpl3Only; 52 maintainers = with maintainers; [ happysalada billewanick ]; 53 mainProgram = "lemmy_server"; 54 }; 55}