Installing AMC with Nix

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

1 1
h1. Installing AMC with Nix
2 1
3 2 Thibault P
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.
4 1
5 1
h2. Installation on NixOS
6 1
7 2 Thibault P
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:
8 1
9 1
<pre>
10 1
environment.systemPackages = with pkgs; [
11 1
auto-multiple-choice
12 1
(texlive.combine {
13 1
  inherit (pkgs.texlive) scheme-full;
14 1
  xtra =
15 1
    {
16 1
      pkgs = [ auto-multiple-choice ];
17 1
    };
18 1
})
19 1
];
20 1
</pre>
21 1
22 1
h2. Installation with Nix on non-NixOS platforms
23 1
24 2 Thibault P
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@.
25 1
26 4 Thibault P
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:
27 1
28 1
<pre>
29 5 Thibault P
TEXINPUTS=:.:$(nix eval --raw nixpkgs.auto-multiple-choice.outPath)/tex/latex:$TEXINPUTS env G TEX pdflatex questionnaire
30 1
</pre>
31 1
32 1
h2. Troubleshooting
33 1
34 2 Thibault P
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.