]> Untitled Git - awful.systems.git/blob - lemmy/server.nix
docs: add database information
[awful.systems.git] / lemmy / server.nix
1 { lib, stdenv, rustPlatform, fetchFromGitHub, openssl, postgresql, libiconv
2 , Security, protobuf, rustfmt, nixosTests }:
3 let
4   pinData = lib.importJSON ./pin.json;
5   version = pinData.serverVersion;
6 in rustPlatform.buildRustPackage rec {
7   inherit version;
8   pname = "lemmy-server";
9
10   src = fetchFromGitHub {
11     owner = "LemmyNet";
12     repo = "lemmy";
13     rev = version;
14     sha256 = pinData.serverSha256;
15     fetchSubmodules = true;
16   };
17
18   preConfigure = ''
19     echo 'pub const VERSION: &str = "${version}";' > crates/utils/src/version.rs
20   '';
21
22   cargoSha256 = pinData.serverCargoSha256;
23
24   buildInputs = [ postgresql ]
25     ++ lib.optionals stdenv.isDarwin [ libiconv Security ];
26
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";
33
34   PROTOC = "${protobuf}/bin/protoc";
35   PROTOC_INCLUDE = "${protobuf}/include";
36   nativeBuildInputs = [ protobuf rustfmt ];
37
38   passthru.updateScript = ./update.py;
39   passthru.tests.lemmy-server = nixosTests.lemmy;
40
41   doCheck = false;
42   doInstallCheck = false;
43
44   meta = with lib; {
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";
50   };
51 }