nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at devShellTools-shell 180 lines 4.9 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchurl, 5 perlPackages, 6 makeWrapper, 7 wrapGAppsHook3, 8 cairo, 9 dblatex, 10 gnumake, 11 gobject-introspection, 12 graphicsmagick, 13 gsettings-desktop-schemas, 14 gtk3, 15 hicolor-icon-theme, 16 libnotify, 17 librsvg, 18 libxslt, 19 netpbm, 20 opencv, 21 pango, 22 perl, 23 pkg-config, 24 poppler, 25}: 26stdenv.mkDerivation (finalAttrs: { 27 pname = "auto-multiple-choice"; 28 version = "1.7.0"; 29 src = fetchurl { 30 url = "https://download.auto-multiple-choice.net/auto-multiple-choice_${finalAttrs.version}_dist.tar.gz"; 31 # before 1.7.0, the URL pattern used "precomp" instead of "dist". 32 sha256 = "sha256-37kWqgdvZopvNSU6LA/FmY2wfSJz3rRSlaQF2HSbdmA="; 33 }; 34 35 # There's only the Makefile 36 dontConfigure = true; 37 38 makeFlags = [ 39 "PERLPATH=${perl}/bin/perl" 40 # We *need* to set DESTDIR as empty and use absolute paths below, 41 # because the Makefile ignores PREFIX and MODSDIR is required to 42 # be an absolute path to not trigger "portable distribution" check 43 # in auto-multiple-choice.in. 44 "DESTDIR=" 45 # Set variables from Makefile.conf to absolute paths 46 "BINDIR=${placeholder "out"}/bin" 47 "PERLDIR=${placeholder "out"}/share/perl5" 48 "MODSDIR=${placeholder "out"}/lib" 49 "TEXDIR=${placeholder "out"}/tex/latex/" # what texlive.combine expects 50 "TEXDOCDIR=${placeholder "out"}/share/doc/texmf/" # TODO where to put this? 51 "MAN1DIR=${placeholder "out"}/share/man/man1" 52 "DESKTOPDIR=${placeholder "out"}/share/applications" 53 "METAINFODIR=${placeholder "out"}/share/metainfo" 54 "ICONSDIR=${placeholder "out"}/share/auto-multiple-choice/icons" 55 "CSSDIR=${placeholder "out"}/share/auto-multiple-choice/gtk" 56 "APPICONDIR=${placeholder "out"}/share/icons/hicolor" 57 "LOCALEDIR=${placeholder "out"}/share/locale" 58 "MODELSDIR=${placeholder "out"}/share/auto-multiple-choice/models" 59 "DOCDIR=${placeholder "out"}/share/doc/auto-multiple-choice" 60 "SHARED_MIMEINFO_DIR=${placeholder "out"}/share/mime/packages" 61 "LANG_GTKSOURCEVIEW_DIR=${placeholder "out"}/share/gtksourceview-4/language-specs" 62 # Pretend to be redhat so `install` doesn't try to chown/chgrp. 63 "SYSTEM_TYPE=rpm" 64 "GCC=${stdenv.cc.targetPrefix}cc" 65 "GCC_PP=${stdenv.cc.targetPrefix}c++" 66 ]; 67 68 preFixup = '' 69 makeWrapperArgs+=("''${gappsWrapperArgs[@]}") 70 ''; 71 72 postFixup = '' 73 wrapProgram $out/bin/auto-multiple-choice \ 74 ''${makeWrapperArgs[@]} \ 75 --prefix PERL5LIB : "${ 76 with perlPackages; 77 makeFullPerlPath [ 78 ArchiveZip 79 DBDSQLite 80 Cairo 81 CairoGObject 82 DBI 83 Glib 84 GlibObjectIntrospection 85 Gtk3 86 LocaleGettext 87 OpenOfficeOODoc 88 PerlMagick 89 TextCSV 90 XMLParser 91 XMLSimple 92 XMLWriter 93 ] 94 }:"$out/share/perl5 \ 95 --prefix XDG_DATA_DIRS : "$out/share:$XDG_ICON_DIRS:$GSETTINGS_SCHEMAS_PATH" \ 96 --prefix PATH : "$out/bin" \ 97 --set TEXINPUTS ":.:$out/tex/latex" 98 ''; 99 100 nativeBuildInputs = [ 101 pkg-config 102 makeWrapper 103 wrapGAppsHook3 104 gobject-introspection 105 ]; 106 107 buildInputs = [ 108 cairo 109 cairo.dev 110 dblatex 111 gnumake 112 graphicsmagick 113 gsettings-desktop-schemas 114 gtk3 115 hicolor-icon-theme 116 libnotify 117 librsvg 118 libxslt 119 netpbm 120 opencv 121 pango 122 poppler 123 ] 124 ++ (with perlPackages; [ 125 perl 126 ArchiveZip 127 Cairo 128 CairoGObject 129 DBDSQLite 130 DBI 131 Glib 132 GlibObjectIntrospection 133 Gtk3 134 LocaleGettext 135 PerlMagick 136 TextCSV 137 XMLParser 138 XMLSimple 139 XMLWriter 140 ]); 141 142 passthru = { 143 tlType = "run"; 144 pkgs = [ finalAttrs.finalPackage ]; 145 }; 146 147 meta = with lib; { 148 description = "Create and manage multiple choice questionnaires with automated marking"; 149 mainProgram = "auto-multiple-choice"; 150 longDescription = '' 151 Create, manage and mark multiple-choice questionnaires. 152 auto-multiple-choice features automated or manual formatting with 153 LaTeX, shuffling of questions and answers and automated marking using 154 Optical Mark Recognition. 155 156 Questionnaires can be created using either a very simple text syntax, 157 AMC-TXT, or LaTeX. In the latter case, your TeXLive installation must 158 be combined with this package. This can be done in configuration.nix 159 as follows: 160 161 <screen> 162 163 environment.systemPackages = with pkgs; [ 164 auto-multiple-choice 165 (texlive.combine { 166 inherit (pkgs.texlive) scheme-full; 167 inherit auto-multiple-choice; 168 }) 169 ]; 170 </screen> 171 172 For usage instructions, see documentation at the project's homepage. 173 ''; 174 homepage = "https://www.auto-multiple-choice.net/"; 175 changelog = "https://gitlab.com/jojo_boulix/auto-multiple-choice/-/blob/master/ChangeLog"; 176 license = licenses.gpl2Plus; 177 maintainers = [ maintainers.thblt ]; 178 platforms = platforms.all; 179 }; 180})