presentations/flake.nix

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

136 lines
3.2 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
inherit (pkgs) lib;
2025-04-11 18:13:44 +01:00
inherit (nixpkgs.lib) makeOverridable;
inherit (pkgs.stdenvNoCC) mkDerivation;
interStaticFonts = mkDerivation {
pname = "inter-static-fonts";
version = "4.1";
src = pkgs.fetchzip {
url = "https://github.com/rsms/inter/releases/download/v4.1/Inter-4.1.zip";
sha256 = "sha256-5vdKKvHAeZi6igrfpbOdhZlDX2/5+UvzlnCQV6DdqoQ=";
stripRoot = false;
};
installPhase = ''
mkdir -p $out/share/fonts/truetype
cp $src/extras/ttf/*.ttf $out/share/fonts/truetype
'';
};
fontPaths = lib.concatStringsSep ":" [
"${pkgs.inconsolata}/share/fonts/truetype/inconsolata"
"${interStaticFonts}/share/fonts/truetype"
];
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 styles $out
2025-04-11 18:13:44 +01:00
runHook postInstall
'';
};
commonBuildInputs = with pkgs; [
interStaticFonts
2025-04-11 18:13:44 +01:00
(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 \
--font-path "${fontPaths}" \
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
}