projet-fin-etude-rapport/flake.nix
2024-10-26 19:17:42 +02:00

80 lines
1.8 KiB
Nix

{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-parts = {
url = "github:hercules-ci/flake-parts";
inputs.nixpkgs-lib.follows = "nixpkgs";
};
systems.url = "github:nix-systems/default";
};
outputs = {flake-parts, ...} @ inputs:
flake-parts.lib.mkFlake {inherit inputs;} {
systems = import inputs.systems;
perSystem = {
pkgs,
system,
...
}: rec {
devShells.default = pkgs.mkShell {
packages = packages.slides.nativeBuildInputs ++ packages.report.buildInputs;
};
packages.report = pkgs.stdenvNoCC.mkDerivation {
name = "report";
src = ./pdf;
assets = ./assets;
buildInputs = [
pkgs.texlive.combined.scheme-full
];
buildPhase = ''
rm assets
ln -s $assets assets
mkdir -p .cache/texmf-var
latexmk -C
env TEXMFHOME=.cache TEXMFVAR=.cache/texmf-var \
latexmk -pdf -shell-escape -lualatex paper.tex
'';
installPhase = ''
mkdir -p $out
mv paper.pdf $out
'';
};
packages.slides = pkgs.stdenvNoCC.mkDerivation rec {
name = "slides";
src = ./slides;
assets = ./assets;
npmDeps = pkgs.fetchNpmDeps {
inherit src;
hash = "sha256-GJ10or/LERFOsBG6CqnRFXnXSEZB7+0C5CV6t8X/Um8=";
};
nativeBuildInputs = [
pkgs.npmHooks.npmConfigHook
pkgs.nodejs
];
buildPhase = ''
rm assets
ln -s $assets assets
npm run build
'';
installPhase = ''
mv dist $out
'';
};
};
};
}