presentations/flake.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

113 lines
2.5 KiB
Nix
Raw Normal View History

2023-01-12 17:07:35 +00:00
{
2025-04-11 18:13:44 +01:00
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
2023-01-12 17:07:35 +00:00
2024-07-23 22:13:02 +01:00
outputs =
{ nixpkgs, ... }:
2024-04-21 23:07:31 +01:00
let
system = "x86_64-linux";
2025-04-11 18:13:44 +01:00
pkgs = import nixpkgs { inherit system; };
2023-05-06 12:23:46 +01:00
2025-04-11 18:13:44 +01:00
inherit (nixpkgs.lib) makeOverridable;
inherit (pkgs.stdenvNoCC) mkDerivation;
2025-04-15 23:54:12 +01:00
shared-assets = mkDerivation {
name = "talks-shared-assets";
2025-04-11 18:13:44 +01:00
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 {
2025-04-15 23:54:12 +01:00
inherit name shared-assets src;
2025-04-11 18:13:44 +01:00
buildInputs = commonBuildInputs;
2025-04-12 00:03:47 +01:00
phases = [
"unpackPhase"
"installPhase"
"buildPhase"
];
2025-04-11 18:13:44 +01:00
2025-04-12 00:03:47 +01:00
installPhase = ''
runHook preInstall
2025-04-11 18:13:44 +01:00
rst2pdf slides.rst \
--break-level 1 \
2025-04-12 00:03:47 +01:00
--extension-module preprocess \
2025-04-11 18:13:44 +01:00
--fit-background-mode scale \
2025-04-15 23:54:12 +01:00
--font-path "${toString shared-assets}/fonts" \
2025-04-12 00:03:47 +01:00
--output slides.pdf \
2025-04-15 23:54:12 +01:00
--stylesheets bw,"${toString shared-assets}/styles/opdavies-light"
2025-04-11 18:13:44 +01:00
2025-04-12 00:03:47 +01:00
runHook postInstall
'';
buildPhase = ''
runHook preBuild
mkdir $out
cp slides.pdf $out
2025-04-11 18:13:44 +01:00
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;
};
};
2024-07-23 22:13:02 +01:00
in
{
2025-04-11 18:13:44 +01:00
devShells.${system}.default =
with pkgs;
mkShell {
packages =
with pkgs;
commonBuildInputs
++ [
ghostscript
just
pdfpc
texliveMedium # includes pdfjam
];
};
packages.${system} = {
2025-04-15 23:54:12 +01:00
inherit shared-assets;
2025-04-11 18:13:44 +01:00
} // talks;
2024-04-21 23:07:31 +01:00
2025-04-11 18:13:44 +01:00
formatter.${system} = pkgs.nixfmt-rfc-style;
2023-05-06 12:23:46 +01:00
};
2023-01-12 17:07:35 +00:00
}