]> Untitled Git - awful.systems.git/blob - lemmy/server.nix
Initial commit
[awful.systems.git] / lemmy / server.nix
1 { lib
2 , stdenv
3 , rustPlatform
4 , fetchFromGitHub
5 , openssl
6 , postgresql
7 , libiconv
8 , Security
9 , protobuf
10 , rustfmt
11 , nixosTests
12 }:
13 let
14   pinData = lib.importJSON ./pin.json;
15   version = pinData.version;
16 in
17 rustPlatform.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   doCheck = false;
49   doInstallCheck = false;
50
51   meta = with lib; {
52     description = "🐀 Building a federated alternative to reddit in rust";
53     homepage = "https://join-lemmy.org/";
54     license = licenses.agpl3Only;
55     maintainers = with maintainers; [ happysalada billewanick ];
56     mainProgram = "lemmy_server";
57   };
58 }