Files
thesis/flake.nix
T
2026-06-19 17:59:47 +03:00

107 lines
2.6 KiB
Nix

{
description = "BGU MSc Thesis ROLL Method";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
};
outputs = { self, nixpkgs }:
let
system = "x86_64-linux";
pkgs = import nixpkgs { inherit system; };
texPkgs = with pkgs.texlive; {
inherit (pkgs.texlive)
scheme-small
latexmk
# Hebrew + multilingual (XeLaTeX path)
bidi
polyglossia
# Page layout
fancyhdr
setspace
titling
appendix
# Figures
caption
float
pgf
# Math
mathtools
amsmath
amscls
gensymb
# Text
enumitem
footmisc
csquotes
# Theorems + algorithms
relsize
ntheorem
chngcntr
algorithm2e
# Bibliography
natbib
tocbibind
# Cross-references
zref
ifoddpage
cleveref
# Misc
silence
;
};
fontsConf = pkgs.makeFontsConf {
fontDirectories = [ pkgs.culmus ];
};
in
{
devShells.${system}.default = pkgs.mkShell {
buildInputs = [ (pkgs.texlive.combine texPkgs) pkgs.culmus pkgs.fontconfig ];
shellHook = ''
export FONTCONFIG_FILE="${fontsConf}"
'';
};
packages.${system}.default = pkgs.stdenvNoCC.mkDerivation rec {
name = "roll-thesis";
src = self;
buildInputs = [
pkgs.coreutils
pkgs.fontconfig
(pkgs.texlive.combine texPkgs)
pkgs.culmus
];
phases = [ "unpackPhase" "buildPhase" "installPhase" ];
buildPhase = ''
export PATH="${pkgs.lib.makeBinPath buildInputs}";
mkdir -p .cache/texmf-var .cache/fontconfig
# Build a fontconfig pointing at culmus with a writable cache
FCACHE="$(pwd)/.cache/fontconfig"
cat > .cache/fonts.conf <<EOF
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<dir>${pkgs.culmus}/share/fonts/truetype</dir>
<cachedir>$FCACHE</cachedir>
</fontconfig>
EOF
export FONTCONFIG_FILE="$(pwd)/.cache/fonts.conf"
export FONTCONFIG_CACHE="$FCACHE"
fc-cache -f 2>/dev/null || true
env TEXMFHOME=.cache TEXMFVAR=.cache/texmf-var \
latexmk -xelatex -f --interaction=nonstopmode \
main.tex || true
test -f main.pdf
'';
installPhase = ''
mkdir -p $out
cp main.pdf $out/
'';
};
};
}