Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 79 lines 1.9 kB view raw
1{ 2 lib, 3 stdenv, 4 rustPlatform, 5 fetchFromGitHub, 6 openssl, 7 libpq, 8 libiconv, 9 protobuf, 10 rustfmt, 11 nixosTests, 12}: 13let 14 pinData = lib.importJSON ./pin.json; 15 version = pinData.serverVersion; 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 hash = pinData.serverHash; 26 fetchSubmodules = true; 27 }; 28 29 preConfigure = '' 30 echo 'pub const VERSION: &str = "${version}";' > crates/utils/src/version.rs 31 ''; 32 33 cargoHash = pinData.serverCargoHash; 34 35 buildInputs = [ 36 libpq 37 ] 38 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 39 libiconv 40 ]; 41 42 # Using OPENSSL_NO_VENDOR is not an option on darwin 43 # As of version 0.10.35 rust-openssl looks for openssl on darwin 44 # with a hardcoded path to /usr/lib/libssl.x.x.x.dylib 45 # https://github.com/sfackler/rust-openssl/blob/master/openssl-sys/build/find_normal.rs#L115 46 OPENSSL_LIB_DIR = "${lib.getLib openssl}/lib"; 47 OPENSSL_INCLUDE_DIR = "${openssl.dev}/include"; 48 49 PROTOC = "${protobuf}/bin/protoc"; 50 PROTOC_INCLUDE = "${protobuf}/include"; 51 nativeBuildInputs = [ 52 protobuf 53 rustfmt 54 ]; 55 56 checkFlags = [ 57 # test requires database access 58 "--skip=session_middleware::tests::test_session_auth" 59 60 # tests require network access 61 "--skip=scheduled_tasks::tests::test_nodeinfo_mastodon_social" 62 "--skip=scheduled_tasks::tests::test_nodeinfo_lemmy_ml" 63 ]; 64 65 passthru.updateScript = ./update.py; 66 passthru.tests.lemmy-server = nixosTests.lemmy; 67 68 meta = with lib; { 69 description = "🐀 Building a federated alternative to reddit in rust"; 70 homepage = "https://join-lemmy.org/"; 71 license = licenses.agpl3Only; 72 maintainers = with maintainers; [ 73 happysalada 74 billewanick 75 georgyo 76 ]; 77 mainProgram = "lemmy_server"; 78 }; 79}