Files
itc.verteilte-anwendungen/flake.nix
2026-01-26 09:30:45 +01:00

141 lines
4.0 KiB
Nix

{
description = "Verteilte Anwedungen -- Solo Projekt";
inputs = {
flake-parts.url = "github:hercules-ci/flake-parts";
nixpkgs.url = "github:NixOS/nixpkgs/9da7f1cf7f8a6e2a7cb3001b048546c92a8258b4";
cartograph-cf = {
url = "github:0qln/CartographCF-Nerdfont";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs @ {
flake-parts,
self,
...
}:
flake-parts.lib.mkFlake {inherit inputs;} {
imports = [];
systems = ["x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin"];
perSystem = {
config,
self',
inputs',
pkgs,
system,
...
}:
with pkgs.lib; let
fonts = with pkgs; [
ibm-plex
cartographcf-nerdfont
];
latexPackages = with pkgs; [
latexrun
(texlive.withPackages
(ps:
with ps; [
amsmath
biber
biblatex
biblatex-ieee
changepage
csquotes
enumitem
caption
fontaxes
latexmk
listings
minted
newtx
newtxsf
newtxtt
scheme-medium
textpos
times
titlesec
transparent
upquote
tocloft
makecell
appendix
apa
csquotes
csquotes-de
]))
];
in {
_module.args.pkgs = import inputs.nixpkgs {
inherit system;
overlays = [
inputs.cartograph-cf.overlays.default
];
config = {};
};
# Per-system attributes can be defined here. The self' and inputs'
# module parameters provide easy access to attributes of the same
# system.
packages = with pkgs; {
default = stdenvNoCC.mkDerivation rec {
name = "seriousgames-seminar";
version = "1.0.0";
src = ./.;
buildInputs = latexPackages;
buildPhase =
# sh
''
cd .
mkdir -p out
# https://github.com/NixOS/nixpkgs/issues/180639#issuecomment-1178984307
export HOME=$(mktemp -d)
# https://wiki.contextgarden.net/Characters_words_and_fonts/Fonts_in_LuaTeX
mkdir -p .fonts
(cd .fonts && ${concatMapStrings (x: "ln -s ${x} '${x.meta.name}'; ") fonts})
export OSFONTDIR=".fonts"
ls .fonts
build() {
latexmk \
-l -dir-report -file-line-error -verbose \
-interaction=nonstopmode \
"main.tex"
}
build
'';
installPhase =
# sh
''
mkdir -p $out/share $out/log $out/artifacts
cp out/main.pdf "$out/share/seriousgames-telemetry.pdf"
cp out/*.log $out/log/
cp -r out/* $out/artifacts
'';
};
};
devShells.default = with pkgs;
mkShell {
nativeBuildInputs = fonts;
packages = [mermaid-cli] ++ latexPackages;
shellHook =
# bash
''
export PATH="$PATH:bin/"
'';
};
};
flake = {
# The usual flake attributes can be defined here, including system-
# agnostic ones like nixosModule and system-enumerating ones, although
# those are more easily expressed in perSystem.
};
};
}