e11sync

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | LICENSE

e11sync-static.nix (913B) - Raw


      1 {
      2   runCommand,
      3   zopfli,
      4   brotli,
      5   findutils,
      6   e11sync-blog,
      7   e11sync-djangostatic,
      8 }:
      9 runCommand "e11sync-static" {
     10   srcs = [e11sync-djangostatic e11sync-blog];
     11   nativeBuildInputs = [findutils];
     12   sourceRoot = ".";
     13 } ''
     14   unpackPhase
     15 
     16   if ! cmp \
     17       e11sync-djangostatic/style.*.css \
     18       e11sync-blog/static/style.*.css
     19     then
     20       echo "style.*.css in blog and djangostatic do not match:"
     21       ls -l e11sync-djangostatic/style/style.*.css blog/style/style.*.css
     22       exit 1
     23   fi
     24 
     25   rm e11sync-djangostatic/style.*.css
     26 
     27   mkdir -p $out
     28   mv e11sync-blog/{static,blog,contact} $out/
     29   mv --no-clobber e11sync-djangostatic/* $out/static/
     30 
     31   find $out \
     32       -name '*.css' -or \
     33       -name '*.js' -or \
     34       -name '*.svg' -or \
     35       -name '*.html' -or \
     36       -name '*.txt' | \
     37       tee >(xargs -n1 -P''$(nproc) ${zopfli}/bin/zopfli) | \
     38       xargs -n1 -P''$(nproc) ${brotli}/bin/brotli
     39 ''