added: new post folder about how i've packaged this repository with ad hoc env and pdf build process with nix updated: src/configs/presnterm.yaml, modified to handle additional arguments in front matter
85 lines
2.6 KiB
Nix
85 lines
2.6 KiB
Nix
{
|
|
description = "An flake to provide dev and build environnement for presenterm post production";
|
|
|
|
# Flake inputs
|
|
inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1";
|
|
|
|
# Flake outputs
|
|
outputs =
|
|
inputs:
|
|
let
|
|
# The systems supported for this flake
|
|
supportedSystems = [
|
|
"x86_64-linux" # 64-bit Intel/AMD Linux
|
|
"aarch64-linux" # 64-bit ARM Linux
|
|
"x86_64-darwin" # 64-bit Intel macOS
|
|
"aarch64-darwin" # 64-bit ARM macOS
|
|
];
|
|
|
|
# Helper to provide system-specific attributes
|
|
forEachSupportedSystem =
|
|
f:
|
|
inputs.nixpkgs.lib.genAttrs supportedSystems (
|
|
system:
|
|
f {
|
|
pkgs = import inputs.nixpkgs { inherit system; };
|
|
}
|
|
);
|
|
in
|
|
{
|
|
devShells = forEachSupportedSystem (
|
|
{ pkgs }: {
|
|
default = pkgs.mkShell {
|
|
# The Nix packages provided in the environment
|
|
# Add any you need here
|
|
packages = with pkgs; [
|
|
presenterm
|
|
python313Packages.weasyprint
|
|
];
|
|
|
|
# Set any environment variables for your dev shell
|
|
env = { };
|
|
|
|
# Add any shell logic you want executed any time the environment is activated
|
|
shellHook = '''';
|
|
};
|
|
}
|
|
);
|
|
packages = forEachSupportedSystem (
|
|
{ pkgs }: {
|
|
default = pkgs.stdenv.mkDerivation {
|
|
inherit (pkgs) system;
|
|
name = "linkedin-shoblog-posts";
|
|
src = ./src;
|
|
buildInputs = with pkgs; [
|
|
presenterm
|
|
python313Packages.weasyprint
|
|
];
|
|
buildPhase = let
|
|
font_dir = "${pkgs.nerd-fonts.jetbrains-mono}/share/fonts/truetype/NerdFonts/JetBrainsMono/";
|
|
config = pkgs.writeTextFile {
|
|
name = "presenterm.conf";
|
|
text = ''
|
|
export:
|
|
dimensions:
|
|
columns: 108
|
|
rows: 85
|
|
pdf:
|
|
fonts:
|
|
normal: ${font_dir}/JetBrainsMonoNerdFont-Regular.ttf
|
|
italic: ${font_dir}/JetBrainsMonoNerdFont-Italic.ttf
|
|
bold: ${font_dir}/JetBrainsMonoNerdFont-Bold.ttf
|
|
bold_italic: ${font_dir}/JetBrainsMonoNerdFont-BoldItalic.ttf
|
|
'';
|
|
};
|
|
in
|
|
''
|
|
export PRES_CONFIG=${config}
|
|
python scripts/build.py
|
|
'';
|
|
};
|
|
}
|
|
);
|
|
};
|
|
}
|