nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 87 lines 2.1 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 env = { 43 # Using OPENSSL_NO_VENDOR is not an option on darwin 44 # As of version 0.10.35 rust-openssl looks for openssl on darwin 45 # with a hardcoded path to /usr/lib/libssl.x.x.x.dylib 46 # https://github.com/sfackler/rust-openssl/blob/master/openssl-sys/build/find_normal.rs#L115 47 OPENSSL_LIB_DIR = "${lib.getLib openssl}/lib"; 48 OPENSSL_INCLUDE_DIR = "${openssl.dev}/include"; 49 50 PROTOC = "${protobuf}/bin/protoc"; 51 PROTOC_INCLUDE = "${protobuf}/include"; 52 }; 53 nativeBuildInputs = [ 54 protobuf 55 rustfmt 56 ]; 57 58 checkFlags = [ 59 # test requires database access 60 "--skip=session_middleware::tests::test_session_auth" 61 62 # tests require network access 63 "--skip=scheduled_tasks::tests::test_nodeinfo_mastodon_social" 64 "--skip=scheduled_tasks::tests::test_nodeinfo_lemmy_ml" 65 ]; 66 67 # This gets installed automatically by cargoInstallHook, 68 # but we don't actually need it, and it leaks a reference to rustc. 69 postInstall = '' 70 rm $out/lib/libhtml2md.so 71 ''; 72 73 passthru.updateScript = ./update.py; 74 passthru.tests.lemmy-server = nixosTests.lemmy; 75 76 meta = { 77 description = "🐀 Building a federated alternative to reddit in rust"; 78 homepage = "https://join-lemmy.org/"; 79 license = lib.licenses.agpl3Only; 80 maintainers = with lib.maintainers; [ 81 happysalada 82 billewanick 83 georgyo 84 ]; 85 mainProgram = "lemmy_server"; 86 }; 87}