diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..c6f63bd --- /dev/null +++ b/flake.lock @@ -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 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..511420b --- /dev/null +++ b/flake.nix @@ -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"; + }; + } + ); + + }; +} diff --git a/make.sh b/make.sh index a1099d9..e13fa0e 100755 --- a/make.sh +++ b/make.sh @@ -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"