e11sync

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

e11sync-djangostatic.nix (800B) - Raw


      1 {
      2   stdenvNoCC,
      3   runCommand,
      4   python3Packages,
      5   findutils,
      6   dart-sass,
      7   jq,
      8 }: let
      9   self = stdenvNoCC.mkDerivation {
     10     name = "e11sync-djangostatic";
     11     srcs = [../app ../static];
     12     sourceRoot = ".";
     13     nativeBuildInputs = [
     14       python3Packages.django
     15       dart-sass
     16       findutils
     17     ];
     18     patchPhase = ''patchShebangs --build app/manage.py'';
     19     buildPhase = ''
     20       make -C static style.css
     21       app/manage.py collectstatic
     22 
     23       # remove unversioned files
     24       pushd app/_static
     25       ${jq}/bin/jq -r '.paths | keys[]' staticfiles.json | xargs rm
     26       popd
     27     '';
     28     installPhase = ''find; mv app/_static $out'';
     29 
     30     passthru.manifest = runCommand "e11sync-djangostatic-manifest" {} ''
     31       mkdir -p $out
     32       cp ${self}/staticfiles.json $out/
     33     '';
     34   };
     35 in
     36   self