projet-fin-etude-rapport/flake.nix

80 lines
1.8 KiB
Nix
Raw Normal View History

2023-06-06 18:47:56 +00:00
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
2024-10-11 16:52:26 +00:00
flake-parts = {
url = "github:hercules-ci/flake-parts";
inputs.nixpkgs-lib.follows = "nixpkgs";
};
systems.url = "github:nix-systems/default";
2023-06-06 18:47:56 +00:00
};
2024-10-11 16:52:26 +00:00
outputs = {flake-parts, ...} @ inputs:
flake-parts.lib.mkFlake {inherit inputs;} {
systems = import inputs.systems;
perSystem = {
pkgs,
system,
...
}: rec {
devShells.default = pkgs.mkShell {
2024-10-11 18:53:38 +00:00
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
env TEXMFHOME=.cache TEXMFVAR=.cache/texmf-var \
latexmk -pdf -shell-escape -lualatex \
paper.tex
'';
installPhase = ''
mkdir -p $out
mv paper.pdf $out
'';
2024-10-11 16:52:26 +00:00
};
packages.slides = pkgs.stdenvNoCC.mkDerivation rec {
name = "slides";
2024-10-11 18:53:52 +00:00
src = ./slides;
assets = ./assets;
2024-10-11 16:52:26 +00:00
npmDeps = pkgs.fetchNpmDeps {
2024-10-11 18:53:52 +00:00
inherit src;
2024-10-11 16:52:26 +00:00
hash = "sha256-GJ10or/LERFOsBG6CqnRFXnXSEZB7+0C5CV6t8X/Um8=";
};
nativeBuildInputs = [
pkgs.npmHooks.npmConfigHook
pkgs.nodejs
];
buildPhase = ''
2024-10-11 18:53:52 +00:00
rm assets
ln -s $assets assets
2024-10-11 16:52:26 +00:00
npm run build
'';
installPhase = ''
mv dist $out
'';
2023-06-06 18:47:56 +00:00
};
2024-10-11 16:52:26 +00:00
};
};
2023-06-06 18:47:56 +00:00
}