mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-08-31 20:54:56 +00:00
Drop the module-level `with lib`. Require settings.hostname instead of defaulting a string option to null. Fix package meta.description and remove unused derivation attrs. Assisted-by: Grok Build (xAI Grok 4.6)
95 lines
2.2 KiB
Nix
95 lines
2.2 KiB
Nix
{
|
|
lib,
|
|
stdenv,
|
|
rustPlatform,
|
|
fetchFromGitHub,
|
|
openssl,
|
|
libpq,
|
|
libiconv,
|
|
protobuf,
|
|
rustfmt,
|
|
nixosTests,
|
|
}:
|
|
let
|
|
pinData = lib.importJSON ./pin.json;
|
|
version = pinData.serverVersion;
|
|
in
|
|
rustPlatform.buildRustPackage (finalAttrs: {
|
|
inherit version;
|
|
pname = "lemmy-server";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "LemmyNet";
|
|
repo = "lemmy";
|
|
tag = finalAttrs.version;
|
|
hash = pinData.serverHash;
|
|
fetchSubmodules = true;
|
|
};
|
|
|
|
preConfigure = ''
|
|
echo 'pub const VERSION: &str = "${finalAttrs.version}";' > crates/utils/src/version.rs
|
|
'';
|
|
|
|
cargoHash = pinData.serverCargoHash;
|
|
|
|
buildInputs = [
|
|
libpq
|
|
]
|
|
++ lib.optionals stdenv.hostPlatform.isDarwin [
|
|
libiconv
|
|
];
|
|
|
|
env = {
|
|
# 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";
|
|
|
|
# #[deny(warnings)] trips on newer rustc
|
|
RUSTFLAGS = "--cap-lints warn";
|
|
};
|
|
nativeBuildInputs = [
|
|
protobuf
|
|
rustfmt
|
|
];
|
|
|
|
checkFlags = [
|
|
# test requires database access
|
|
"--skip=session_middleware::tests::test_session_auth"
|
|
|
|
# tests require network access
|
|
"--skip=scheduled_tasks::tests::test_nodeinfo_mastodon_social"
|
|
"--skip=scheduled_tasks::tests::test_nodeinfo_lemmy_ml"
|
|
];
|
|
|
|
# This gets installed automatically by cargoInstallHook,
|
|
# but we don't actually need it, and it leaks a reference to rustc.
|
|
postInstall = lib.optionalString (!stdenv.hostPlatform.isDarwin) ''
|
|
rm $out/lib/libhtml2md.so
|
|
'';
|
|
|
|
passthru = {
|
|
updateScript = ./update.py;
|
|
tests.lemmy-server = nixosTests.lemmy;
|
|
};
|
|
|
|
meta = {
|
|
description = "Federated link aggregator and forum";
|
|
homepage = "https://join-lemmy.org/";
|
|
license = lib.licenses.agpl3Only;
|
|
maintainers = with lib.maintainers; [
|
|
happysalada
|
|
billewanick
|
|
georgyo
|
|
lucasew
|
|
];
|
|
teams = [ lib.teams.ngi ];
|
|
mainProgram = "lemmy_server";
|
|
};
|
|
})
|