-
-
Save cleverca22/c9ac52d5b3dccc064a82c33418d67d54 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with import <nixpkgs> {}; | |
let | |
ext = ext: path: let eL = builtins.stringLength ext; | |
pL = builtins.stringLength path; | |
in ext == builtins.substring (pL - eL) eL path; | |
things = self: { | |
odt2md = input: runCommand ("${builtins.baseNameOf input}.md") { buildInputs = [ pandoc ]; } '' | |
pandoc -t markdown ${input} > $out | |
''; | |
fileList = builtins.attrNames (lib.filterAttrs (name: value: ext ".odt" name && value == "regular") (builtins.readDir ./.)); | |
mdList = map (file: self.odt2md (./. + "/${file}")) self.fileList; | |
allMds = runCommand "all-the-mds" {} '' | |
mkdir $out | |
cat ${self.mdList} > $out/all-the-things.md | |
''; | |
}; | |
in lib.fix things |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment