modernize

This commit is contained in:
2025-05-31 06:22:19 +02:00
parent 57b5113431
commit 6d29d0fe4a
4 changed files with 94 additions and 31 deletions

1
.envrc Normal file
View File

@@ -0,0 +1 @@
use flake

24
flake.lock generated Normal file
View File

@@ -0,0 +1,24 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1748608111,
"narHash": "sha256-9YDS55RZCRc++4NfZJe3xDmhawAdn+ghpN2Tu3rWeG0=",
"rev": "96ec055edbe5ee227f28cdbc3f1ddf1df5965102",
"type": "tarball",
"url": "https://releases.nixos.org/nixos/unstable/nixos-25.11pre807377.96ec055edbe5/nixexprs.tar.xz?rev=96ec055edbe5ee227f28cdbc3f1ddf1df5965102"
},
"original": {
"type": "tarball",
"url": "https://nixos.org/channels/nixos-unstable/nixexprs.tar.xz"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

53
flake.nix Normal file
View File

@@ -0,0 +1,53 @@
{
inputs.nixpkgs.url = "https://nixos.org/channels/nixos-unstable/nixexprs.tar.xz";
outputs =
{
self,
nixpkgs,
...
}@inputs:
let
forSystems =
systems: f:
inputs.nixpkgs.lib.genAttrs systems (
system:
f {
inherit system;
pkgs = nixpkgs.legacyPackages.${system};
lib = nixpkgs.legacyPackages.${system}.lib;
}
);
forAllSystems = forSystems nixpkgs.lib.systems.flakeExposed;
in
{
inherit inputs;
devShells = forAllSystems (
{ pkgs, ... }:
{
default = pkgs.mkShellNoCC {
packages = with pkgs; [
pandoc
#haskellPackages.pandoc-crossref
#pandoc-imagine
#haskellPackages.pandoc-plot
(texlive.combine {
inherit (texlive)
scheme-small
#latexmk
;
})
];
# stops /etc/profile.d/nix-daemon.sh on Arch from clobbering this shell
__ETC_PROFILE_NIX_SOURCED = 1;
# unbreaks locale for lualatex
LOCALE_ARCHIVE = "${pkgs.glibcLocales}/lib/locale/locale-archive";
};
}
);
};
}

47
make.sh
View File

@@ -1,37 +1,22 @@
#!/usr/bin/env bash
pandoc_to_pdf ()
{
#VARIABLES="--filter pandoc-codeblock-include --filter pandoc-crossref --filter pandoc-imagine";
VARIABLES="$VARIABLES --variable papersize=a4paper";
VARIABLES="$VARIABLES --table-of-contents";
VARIABLES="$VARIABLES --number-sections";
VARIABLES="$VARIABLES --variable links-as-notes=true";
VARIABLES="$VARIABLES --highlight-style=pygments";
if test "$1" == ""; then
echo you must supply an input!;
else
if test "$2" == ""; then
echo you must supply an output!;
else
source="$1";
shift;
dest="$1";
shift;
pandoc "$source" --pdf-engine="xelatex" $VARIABLES "$@" -o "$dest";
fi;
fi
}
declare -a PANDOC_VARIABLES=(
#--filter pandoc-codeblock-include
#--filter pandoc-crossref
#--filter pandoc-imagine
--variable papersize=a4paper
--table-of-contents
--number-sections
--variable links-as-notes=true
--highlight-style=pygments
--pdf-engine="xelatex"
)
(
{
cat header.md
curl "http://www.pvv.ntnu.no/w/index.php?title=Halv%C3%A5rsm%C3%B8te/2019H&action=raw" |
pandoc -f mediawiki -t gfm
curl "https://wiki.pvv.ntnu.no/wiki/Halv%C3%A5rsm%C3%B8te/2019H?action=raw" \
| pandoc -f mediawiki -t gfm
cat footer.md
) > out.md
} | pandoc -f markdown "${PANDOC_VARIABLES[@]}" -o out.pdf
pandoc_to_pdf out.md out.pdf
rm out.md
echo written to out.pdf
echo >&2 "Written to out.pdf"