presentations/flake.nix

98 lines
2.2 KiB
Nix

{
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
outputs =
{ nixpkgs, ... }:
let
system = "x86_64-linux";
pkgs = import nixpkgs { inherit system; };
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
'';
};
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;
};
}