2022-05-18 14:49:53 +00:00
{ stdenv , lib , fetchurl , makeWrapper , nixosTests
, buildPerlPackage
, coreutils
, curl
, git
, gnumake
, highlight
, libgit2
2023-07-15 17:15:38 +00:00
, libxcrypt
2022-05-18 14:49:53 +00:00
, man
, openssl
, pkg-config
, sqlite
, xapian
, AnyURIEscape
, DBDSQLite
, DBI
, EmailAddressXS
, EmailMIME
, IOSocketSSL
2023-07-15 17:15:38 +00:00
# FIXME: to be packaged
#, IOSocketSocks
2022-05-18 14:49:53 +00:00
, IPCRun
, Inline
, InlineC
, LinuxInotify2
, MailIMAPClient
2023-07-15 17:15:38 +00:00
# FIXME: to be packaged
#, NetNetrc
# FIXME: to be packaged
#, NetNNTP
2022-05-18 14:49:53 +00:00
, ParseRecDescent
, Plack
, PlackMiddlewareReverseProxy
2023-07-15 17:15:38 +00:00
, PlackTestExternalServer
2022-05-18 14:49:53 +00:00
, SearchXapian
2023-07-15 17:15:38 +00:00
, TestSimple13
2022-05-18 14:49:53 +00:00
, TimeDate
, URI
2023-07-15 17:15:38 +00:00
, XMLTreePP
2020-04-24 23:36:52 +00:00
} :
let
2022-05-18 14:49:53 +00:00
skippedTests = [
2023-07-15 17:15:38 +00:00
# fatal: Could not make /tmp/pi-search-9188-DGZM/a.git/branches/ writable by group
" s e a r c h "
2022-05-18 14:49:53 +00:00
# perl5.32.0-public-inbox> t/eml.t ...................... 1/? Cannot parse parameter '=?ISO-8859-1?Q?=20charset=3D=1BOF?=' at t/eml.t line 270.
# perl5.32.0-public-inbox> # Failed test 'got wide character by assuming utf-8'
# perl5.32.0-public-inbox> # at t/eml.t line 272.
# perl5.32.0-public-inbox> Wide character in print at /nix/store/38vxlxrvg3yji3jms44qn94lxdysbj5j-perl-5.32.0/lib/perl5/5.32.0/Test2/Formatter/TAP.pm line 125.
" e m l "
# Failed test 'Makefile OK'
# at t/hl_mod.t line 19.
# got: 'makefile'
# expected: 'make'
" h l _ m o d "
2023-08-22 20:05:09 +00:00
# Hangs on "inbox unlocked on initial fetch, waiting for IDLE".
# Fixed in HEAD: 7234e671 ("t/imapd: workaround a Perl 5.36.0 readline regression")
" i m a p d "
2022-05-18 14:49:53 +00:00
# Failed test 'clone + index v1 synced ->created_at'
# at t/lei-mirror.t line 175.
# got: '1638378723'
# expected: undef
# Failed test 'clone + index v1 synced ->created_at'
# at t/lei-mirror.t line 178.
# got: '1638378723'
# expected: undef
# May be due to the use of $ENV{HOME}.
" l e i - m i r r o r "
# Failed test 'child error (pure-Perl)'
# at t/spawn.t line 33.
# got: '0'
# expected: anything else
# waiting for child to reap grandchild...
" s p a w n "
2023-07-15 17:15:38 +00:00
# Failed to connect to 127.0.0.1
" v 2 m i r r o r "
2022-05-18 14:49:53 +00:00
] ;
2020-04-24 23:36:52 +00:00
testConditions = with lib ;
concatMapStringsSep " " ( n : " ! - n a m e ${ escapeShellArg n } . t " ) skippedTests ;
in
buildPerlPackage rec {
pname = " p u b l i c - i n b o x " ;
2023-07-15 17:15:38 +00:00
version = " 1 . 9 . 0 " ;
2020-04-24 23:36:52 +00:00
src = fetchurl {
2022-05-18 14:49:53 +00:00
url = " h t t p s : / / p u b l i c - i n b o x . o r g / p u b l i c - i n b o x . g i t / s n a p s h o t / p u b l i c - i n b o x - ${ version } . t a r . g z " ;
2023-07-15 17:15:38 +00:00
sha256 = " s h a 2 5 6 - E N n T 2 Y K 7 r p O D I I 9 T q i E Y S C p 5 m p W O n x s k e S u A f 8 I l q r o = " ;
2020-04-24 23:36:52 +00:00
} ;
outputs = [ " o u t " " d e v d o c " " s a _ c o n f i g " ] ;
postConfigure = ''
substituteInPlace Makefile - - replace ' TEST_FILES = t /* . t ' \
' TEST_FILES = $ ( shell find t - name * . t $ { testConditions } ) '
2022-05-18 14:49:53 +00:00
substituteInPlace lib/PublicInbox/TestCommon.pm \
- - replace /bin/cp $ { coreutils } /bin/cp
2020-04-24 23:36:52 +00:00
'' ;
nativeBuildInputs = [ makeWrapper ] ;
buildInputs = [
2022-05-18 14:49:53 +00:00
AnyURIEscape
DBDSQLite
DBI
EmailAddressXS
highlight
IOSocketSSL
2023-07-15 17:15:38 +00:00
#IOSocketSocks
2022-05-18 14:49:53 +00:00
IPCRun
Inline
InlineC
2023-07-15 17:15:38 +00:00
MailIMAPClient
#NetNetrc
#NetNNTP
2022-05-18 14:49:53 +00:00
ParseRecDescent
Plack
PlackMiddlewareReverseProxy
SearchXapian
TimeDate
URI
libgit2 # For Gcf2
man
2020-04-24 23:36:52 +00:00
] ;
2022-05-18 14:49:53 +00:00
doCheck = ! stdenv . isDarwin ;
2023-02-02 18:25:31 +00:00
nativeCheckInputs = [
2022-05-18 14:49:53 +00:00
curl
git
openssl
pkg-config
sqlite
xapian
2023-07-15 17:15:38 +00:00
EmailMIME
PlackTestExternalServer
TestSimple13
XMLTreePP
2022-05-18 14:49:53 +00:00
] ++ lib . optionals stdenv . isLinux [
LinuxInotify2
] ;
2020-04-24 23:36:52 +00:00
preCheck = ''
perl certs/create-certs.perl
2022-05-18 14:49:53 +00:00
export TEST_LEI_ERR_LOUD = 1
export HOME = " $ N I X _ B U I L D _ T O P " /home
mkdir - p " $ H O M E " /.cache/public-inbox/inline-c
2020-04-24 23:36:52 +00:00
'' ;
installTargets = [ " i n s t a l l " ] ;
postInstall = ''
for prog in $ out/bin /* ; d o
2023-07-15 17:15:38 +00:00
wrapProgram $ prog \
- - set NIX_CFLAGS_COMPILE_ $ { stdenv . cc . suffixSalt } - I $ { lib . getDev libxcrypt } /include \
- - prefix PATH : $ { lib . makeBinPath [
git
xapian
/* f o r I n l i n e C */
gnumake
stdenv . cc
] }
2020-04-24 23:36:52 +00:00
done
mv sa_config $ sa_config
'' ;
2022-05-18 14:49:53 +00:00
passthru . tests = {
nixos-public-inbox = nixosTests . public-inbox ;
} ;
2020-04-24 23:36:52 +00:00
meta = with lib ; {
homepage = " h t t p s : / / p u b l i c - i n b o x . o r g / " ;
license = licenses . agpl3Plus ;
2022-05-18 14:49:53 +00:00
maintainers = with maintainers ; [ julm qyliss ] ;
2020-04-24 23:36:52 +00:00
platforms = platforms . all ;
} ;
}