nixpkgs-suyu/pkgs/servers/web-apps/lemmy/server.nix
Brian Leung cbf8e91772 nixos/tests/lemmy: init
Co-authored-by: Ctem <c@ctem.me>
Co-authored-by: cab <cab404@mailbox.org>
Co-authored-by: a-kenji <aks.kenji@protonmail.com>
Co-authored-by: Shahar Dawn Or <mightyiampresence@gmail.com>
Co-authored-by: Matthias Meschede <MMesch@users.noreply.github.com>
Co-authored-by: Ilan Joselevich <personal@ilanjoselevich.com>
2022-09-02 05:55:11 -04:00

55 lines
1.4 KiB
Nix

{ lib
, stdenv
, rustPlatform
, fetchFromGitHub
, openssl
, postgresql
, libiconv
, Security
, protobuf
, rustfmt
, nixosTests
}:
let
pinData = lib.importJSON ./pin.json;
version = pinData.version;
in
rustPlatform.buildRustPackage rec {
inherit version;
pname = "lemmy-server";
src = fetchFromGitHub {
owner = "LemmyNet";
repo = "lemmy";
rev = version;
sha256 = pinData.serverSha256;
fetchSubmodules = true;
};
cargoSha256 = pinData.serverCargoSha256;
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
OPENSSL_LIB_DIR = "${lib.getLib openssl}/lib";
OPENSSL_INCLUDE_DIR = "${openssl.dev}/include";
PROTOC = "${protobuf}/bin/protoc";
PROTOC_INCLUDE = "${protobuf}/include";
nativeBuildInputs = [ protobuf rustfmt ];
passthru.updateScript = ./update.sh;
passthru.tests.lemmy-server = nixosTests.lemmy;
meta = with lib; {
description = "🐀 Building a federated alternative to reddit in rust";
homepage = "https://join-lemmy.org/";
license = licenses.agpl3Only;
maintainers = with maintainers; [ happysalada billewanick ];
mainProgram = "lemmy_server";
};
}