nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at devShellTools-shell 145 lines 4.2 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchurl, 5 fetchpatch, 6 perlPackages, 7 gettext, 8 makeWrapper, 9 ImageMagick, 10 which, 11 highlight, 12 gitSupport ? false, 13 git, 14 docutilsSupport ? false, 15 python3, 16 docutils, 17 monotoneSupport ? false, 18 monotone, 19 bazaarSupport ? false, 20 breezy, 21 cvsSupport ? false, 22 cvs, 23 cvsps, 24 subversionSupport ? false, 25 subversion, 26 mercurialSupport ? false, 27 mercurial, 28 extraUtils ? [ ], 29}: 30 31stdenv.mkDerivation rec { 32 pname = "ikiwiki"; 33 version = "3.20200202.3"; 34 35 src = fetchurl { 36 url = "mirror://debian/pool/main/i/ikiwiki/ikiwiki_${version}.orig.tar.xz"; 37 sha256 = "0skrc8r4wh4mjfgw1c94awr5sacfb9nfsbm4frikanc9xsy16ksr"; 38 }; 39 40 nativeBuildInputs = [ makeWrapper ]; 41 buildInputs = [ 42 which 43 highlight 44 ] 45 ++ (with perlPackages; [ 46 perl 47 TextMarkdown 48 URI 49 HTMLParser 50 HTMLScrubber 51 HTMLTemplate 52 TimeDate 53 gettext 54 DBFile 55 CGISession 56 CGIFormBuilder 57 LocaleGettext 58 RpcXML 59 XMLSimple 60 ImageMagick 61 YAML 62 YAMLLibYAML 63 HTMLTree 64 AuthenPassphrase 65 NetOpenIDConsumer 66 LWPxParanoidAgent 67 CryptSSLeay 68 ]) 69 ++ lib.optionals docutilsSupport [ 70 (python3.withPackages (pp: with pp; [ pygments ])) 71 docutils 72 ] 73 ++ lib.optionals gitSupport [ git ] 74 ++ lib.optionals monotoneSupport [ monotone ] 75 ++ lib.optionals bazaarSupport [ breezy ] 76 ++ lib.optionals cvsSupport [ 77 cvs 78 cvsps 79 perlPackages.Filechdir 80 ] 81 ++ lib.optionals subversionSupport [ subversion ] 82 ++ lib.optionals mercurialSupport [ mercurial ]; 83 84 patches = [ 85 # A few markdown tests fail, but this is expected when using Text::Markdown 86 # instead of Text::Markdown::Discount. 87 ./remove-markdown-tests.patch 88 89 (fetchpatch { 90 name = "Catch-up-to-highlight-4.0-API-change"; 91 url = "http://source.ikiwiki.branchable.com/?p=source.git;a=patch;h=9ea3f9dfe7c0341f4e002b48728b8139293e19d0"; 92 sha256 = "16s4wvsfclx0a5cm2awr69dvw2vsi8lpm0d7kyl5w0kjlmzfc7h9"; 93 }) 94 ]; 95 96 postPatch = '' 97 sed -i s@/usr/bin/perl@${perlPackages.perl}/bin/perl@ pm_filter mdwn2man 98 sed -i s@/etc/ikiwiki@$out/etc@ Makefile.PL 99 sed -i /ENV{PATH}/d ikiwiki.in 100 # State the gcc dependency, and make the cgi use our wrapper 101 sed -i -e 's@$0@"'$out/bin/ikiwiki'"@' \ 102 -e "s@'cc'@'${stdenv.cc}/bin/gcc'@" IkiWiki/Wrapper.pm 103 # Without patched plugin shebangs, some tests like t/rst.t fail 104 # (with docutilsSupport enabled) 105 patchShebangs plugins/* 106 107 # Creating shared git repo fails when running tests in Nix sandbox. 108 # The error is: "fatal: Could not make /tmp/ikiwiki-test-git.2043/repo/branches/ writable by group". 109 # Hopefully, not many people use `ikiwiki-makerepo` to create locally shared repositories these days. 110 substituteInPlace ikiwiki-makerepo --replace "git --bare init --shared" "git --bare init" 111 ''; 112 113 configurePhase = "perl Makefile.PL PREFIX=$out"; 114 115 postInstall = '' 116 for a in "$out/bin/"*; do 117 wrapProgram $a --suffix PERL5LIB : $PERL5LIB --prefix PATH : ${perlPackages.perl}/bin:$out/bin \ 118 ${lib.optionalString gitSupport "--prefix PATH : ${git}/bin "} \ 119 ${lib.optionalString monotoneSupport "--prefix PATH : ${monotone}/bin "} \ 120 ${lib.optionalString bazaarSupport "--prefix PATH : ${breezy}/bin "} \ 121 ${lib.optionalString cvsSupport "--prefix PATH : ${cvs}/bin "} \ 122 ${lib.optionalString cvsSupport "--prefix PATH : ${cvsps}/bin "} \ 123 ${lib.optionalString subversionSupport "--prefix PATH : ${subversion.out}/bin "} \ 124 ${lib.optionalString mercurialSupport "--prefix PATH : ${mercurial}/bin "} \ 125 ${lib.optionalString docutilsSupport ''--prefix PYTHONPATH : "$(toPythonPath ${docutils})" ''} \ 126 ${lib.concatMapStrings (x: "--prefix PATH : ${x}/bin ") extraUtils} 127 done 128 ''; 129 130 preCheck = '' 131 # Git needs some help figuring this out during test suite run. 132 export EMAIL="nobody@example.org" 133 ''; 134 135 checkTarget = "test"; 136 doCheck = true; 137 138 meta = with lib; { 139 description = "Wiki compiler, storing pages and history in a RCS"; 140 homepage = "http://ikiwiki.info/"; 141 license = licenses.gpl2Plus; 142 platforms = platforms.linux; 143 maintainers = [ maintainers.wentasah ]; 144 }; 145}