aboutsummaryrefslogtreecommitdiff
path: root/flake.nix
blob: b79f2a32855600221148cd3bad779c2721a7df79 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
{
  description = "Aria Shrimpton dissertation";
  inputs = {
    nixpkgs.url = github:NixOS/nixpkgs/nixos-23.05;
  };
  outputs = {
    self,
    nixpkgs,
  }: let
    system = "x86_64-linux";
    pkgs = nixpkgs.legacyPackages.${system};
    tex = pkgs.texlive.combine {
      inherit
        (pkgs.texlive)
        scheme-small
        microtype
        sectsty
        printlen
        psnfss
        helvetic
        courier
        latex-bin
        latexmk
        ;
    };
  in rec {
    devShells.${system}.default = pkgs.mkShell {
      buildInputs = [
        pkgs.just # command runner
        tex # latex environment

        pkgs.racket-minimal
        pkgs.z3
      ];
    };
    packages.${system} = {
      default = pkgs.stdenvNoCC.mkDerivation rec {
        name = "thesis";
        src = ./thesis;
        buildInputs = [pkgs.coreutils tex];
        phases = ["unpackPhase" "buildPhase" "installPhase"];
        buildPhase = ''
          export PATH="${pkgs.lib.makeBinPath buildInputs}";
          mkdir -p .cache/texmf-var
          env TEXMFHOME=.cache TEXMFVAR=.cache/texmf-var \
            latexmk -interaction=nonstopmode -pdf -lualatex \
            main.tex
        '';
        installPhase = ''
          mkdir -p $out
          cp document.pdf $out/
        '';
      };
    };
  };
}