Installing AMC with Nix

Version 4 (Thibault P, 12/01/2021 10:57 pm) → Version 5/8 (Thibault P, 12/01/2021 10:57 pm)

h1. Installing AMC with Nix

Nix is part of the Nix packages collection, in unstable for now (as of 2021-11-05) and will likely be part of the 21.11 release.

h2. Installation on NixOS

To install, either add @auto-multiple-choice@ to @environment.systemPackages@ in your @configuration.nix@. If you want to use TeX to write your questionnaires, you also need to add the package to your texlive installation, like this:

<pre>
environment.systemPackages = with pkgs; [
auto-multiple-choice
(texlive.combine {
inherit (pkgs.texlive) scheme-full;
xtra =
{
pkgs = [ auto-multiple-choice ];
};
})
];
</pre>

h2. Installation with Nix on non-NixOS platforms

The usual methods should work. You can either get a shell with AMC installed with @nix-shell -p auto-multiple-choice@, or install AMC in the user environment with @nix-env -i auto-multiple-choice@.

In both these cases, though, the @.sty@ file won't be available to your TeXLive installation. To fix this, you can pass LaTeX an explicit @TEXINPUTS@, like this:

<pre>
TEXINPUTS=:.:$(nix eval --raw nixpkgs.auto-multiple-choice.outPath)/tex/latex:$TEXINPUTS nixpkgs.auto-multiple-choice.outPath | cut -d '"' -f 2)/tex/latex:$TEXINPUTS env G TEX pdflatex questionnaire
</pre>

h2. Troubleshooting

AMC has been added _very_ recently to Nixpkgs. If you encounter errors, make sure you're on unstable or at least 21.11 (not yet released at the time of this writing), and update your channels before installing.