Build slides with Nix
This commit is contained in:
parent
e80aee1deb
commit
6f98c753c2
6 changed files with 111 additions and 131 deletions
101
flake.nix
101
flake.nix
|
@ -1,25 +1,98 @@
|
|||
{
|
||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
|
||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
|
||||
outputs =
|
||||
{ nixpkgs, ... }:
|
||||
let
|
||||
system = "x86_64-linux";
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
|
||||
inherit (pkgs) mkShell nixfmt-classic;
|
||||
in
|
||||
{
|
||||
devShells.${system}.default = mkShell {
|
||||
packages = with pkgs; [
|
||||
ghostscript
|
||||
pdfpc
|
||||
python310Packages.rst2pdf
|
||||
texliveMedium # includes pdfjam
|
||||
tree
|
||||
];
|
||||
inherit (nixpkgs.lib) makeOverridable;
|
||||
inherit (pkgs.stdenvNoCC) mkDerivation;
|
||||
|
||||
shared = mkDerivation {
|
||||
name = "talks-shared";
|
||||
src = ./src;
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir $out
|
||||
cp -r fonts styles $out
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
};
|
||||
|
||||
formatter.${system} = nixfmt-classic;
|
||||
commonBuildInputs = with pkgs; [
|
||||
(python310.withPackages (p: with p; [ rst2pdf ]))
|
||||
];
|
||||
|
||||
mkTalk = makeOverridable (
|
||||
{ name, src }:
|
||||
mkDerivation {
|
||||
inherit name shared src;
|
||||
|
||||
buildInputs = commonBuildInputs;
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
|
||||
mkdir $out
|
||||
|
||||
rst2pdf slides.rst \
|
||||
--break-level 1 \
|
||||
--fit-background-mode scale \
|
||||
--font-path "${toString shared}/fonts" \
|
||||
--output "$out/slides.pdf" \
|
||||
--stylesheets bw,"${toString shared}/styles/opdavies-light"
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
}
|
||||
);
|
||||
|
||||
talks = {
|
||||
build-configs = mkTalk {
|
||||
name = "build-configs";
|
||||
src = ./src/building-build-configs;
|
||||
};
|
||||
|
||||
sculpin = mkTalk {
|
||||
name = "building-static-websites-sculpin";
|
||||
src = ./src/building-static-websites-sculpin;
|
||||
};
|
||||
|
||||
tailwind-css = mkTalk {
|
||||
name = "taking-flight-with-tailwind-css";
|
||||
src = ./src/taking-flight-with-tailwind-css;
|
||||
};
|
||||
|
||||
test-driven-drupal = mkTalk {
|
||||
name = "test-driven-drupal";
|
||||
src = ./src/test-driven-drupal;
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
devShells.${system}.default =
|
||||
with pkgs;
|
||||
mkShell {
|
||||
packages =
|
||||
with pkgs;
|
||||
commonBuildInputs
|
||||
++ [
|
||||
ghostscript
|
||||
just
|
||||
pdfpc
|
||||
texliveMedium # includes pdfjam
|
||||
];
|
||||
};
|
||||
|
||||
packages.${system} = {
|
||||
inherit shared;
|
||||
} // talks;
|
||||
|
||||
formatter.${system} = pkgs.nixfmt-rfc-style;
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue