nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 perl,
6 perlPackages,
7 makeWrapper,
8 openssl,
9 nixosTests,
10}:
11
12perlPackages.buildPerlPackage rec {
13 pname = "convos";
14 version = "8.05";
15
16 src = fetchFromGitHub {
17 owner = "convos-chat";
18 repo = "convos";
19 rev = "v${version}";
20 sha256 = "sha256-dBvXo8y4OMKcb0imgnnzoklnPN3YePHDvy5rIBOkTfs=";
21 };
22
23 nativeBuildInputs = [ makeWrapper ];
24
25 buildInputs = with perlPackages; [
26 CryptPassphrase
27 CryptPassphraseArgon2
28 CryptPassphraseBcrypt
29 FileHomeDir
30 FileReadBackwards
31 HTTPAcceptLanguage
32 SyntaxKeywordTry
33 FutureAsyncAwait
34 IOSocketSSL
35 IRCUtils
36 JSONValidator
37 LinkEmbedder
38 ModuleInstall
39 Mojolicious
40 MojoliciousPluginOpenAPI
41 MojoliciousPluginSyslog
42 ParseIRC
43 TextMarkdownHoedown
44 TimePiece
45 UnicodeUTF8
46 CpanelJSONXS
47 EV
48 YAMLLibYAML
49 ];
50
51 propagatedBuildInputs = [ openssl ];
52
53 nativeCheckInputs = with perlPackages; [ TestDeep ];
54
55 postPatch = ''
56 patchShebangs script/convos
57 '';
58
59 preCheck = ''
60 # Remove unstable test (PR #176640)
61 #
62 rm t/plugin-auth-header.t
63
64 # Remove online test
65 #
66 rm t/web-pwa.t
67
68 # A test fails since gethostbyaddr(127.0.0.1) fails to resolve to localhost in
69 # the sandbox, we replace the this out from a substitution expression
70 #
71 substituteInPlace t/web-register-open-to-public.t \
72 --replace '!127.0.0.1!' '!localhost!'
73
74 # Another online test fails, so remove this.
75 rm t/irc-reconnect.t
76
77 # A webirc test fails to resolve "localhost" likely due to sandboxing, we
78 # remove this test.
79 #
80 rm t/irc-webirc.t
81
82 # A web-user test fails on Darwin, we remove it.
83 #
84 rm t/web-user.t
85
86 # Another web test fails, so we also remove this.
87 rm t/web-login.t
88
89 # Module::Install is a runtime dependency not covered by the tests, so we add
90 # a test for it.
91 #
92 echo "use Test::More tests => 1;require_ok('Module::Install')" \
93 > t/00_nixpkgs_module_install.t
94 '';
95
96 # Convos expects to find assets in both auto/share/dist/Convos, and $MOJO_HOME
97 # which is set to $out
98 #
99 postInstall = ''
100 AUTO_SHARE_PATH=$out/${perl.libPrefix}/auto/share/dist/Convos
101 mkdir -p $AUTO_SHARE_PATH
102 cp -vR public assets $AUTO_SHARE_PATH/
103 ln -s $AUTO_SHARE_PATH/public/assets $out/assets
104 cp -vR templates $out/templates
105 cp Makefile.PL $out/Makefile.PL
106 ''
107 + ''
108 wrapProgram $out/bin/convos --set MOJO_HOME $out
109 '';
110
111 passthru.tests = nixosTests.convos;
112
113 meta = {
114 homepage = "https://convos.chat";
115 description = "IRC browser client";
116 mainProgram = "convos";
117 license = lib.licenses.artistic2;
118 maintainers = with lib.maintainers; [ sgo ];
119 };
120}