{ pkgs ? import <nixpkgs> {} }:

pkgs.python3.pkgs.buildPythonPackage rec {
  pname= "site-musique";
  version = "1.0";

  inherit (pkgs) stdenv;

  src = ./.;

  propagatedBuildInputs = [ pkgs.python3.pkgs.django_2_2 pkgs.python3.pkgs.pillow ];

  postFixup = ''
    wrapPythonProgramsIn $out/bin/manage.py
    #HACK wrapper breaks django manage.py
    sed -i "$out/bin/.manage.py-wrapped" -e '
      0,/sys.argv\[0\].*;/s/sys.argv\[0\][^;]*;//
    '
  '';

  doCheck = false;

  postInstall = ''
    python $out/bin/manage.py collectstatic
  '';

  meta = {
    description = "Site de présentation de l'association Musique Fraternité de Meyenheim";
    homepage = https://musique-meyenheim.fr;
    maintainers = with stdenv.lib.maintainers; [ nyanloutre ];
    license = stdenv.lib.licenses.cc-by-nc-sa-40;
    platforms = stdenv.lib.platforms.all;
  };
}
