spejstore/default.nix

50 lines
1.9 KiB
Nix

{ stdenv, fetchurl, fetchgit, python3, python3Packages, makeWrapper, lib }:
let
django_1_11 = pyPkgs: pyPkgs.django_1_11;
python = python3.override {
packageOverrides = self: super: {
django = django_1_11 super;
# we use some dependencies that are outside of nixpkgs
django-flat-responsive = self.callPackage ./python-modules/django-flat-responsive.nix { };
django-hstore = self.callPackage ./python-modules/django-hstore.nix { };
django-markdown2 = self.callPackage ./python-modules/django-markdown2.nix { };
django-select2 = self.callPackage ./python-modules/django-select2.nix { };
django-tree = self.callPackage ./python-modules/django-tree.nix { };
django-restframework-hstore = self.callPackage ./python-modules/django-restframework-hstore.nix { };
social-auth-app-django = self.callPackage ./python-modules/social-auth-app-django.nix { };
social-auth-core = self.callPackage ./python-modules/social-auth-core.nix { };
};
};
in
stdenv.mkDerivation rec {
name = "spejstore";
src = ./.;
nativeBuildInputs = [ makeWrapper ];
runtimePackages = with python.pkgs; [
certifi chardet django djangorestframework pillow psycopg2 requests urllib3 django_appconf setuptools
django-tree django-flat-responsive django-hstore django-select2 social-auth-app-django django-markdown2 django-restframework-hstore
];
pythonEnv = python.withPackages (_: runtimePackages);
passthru = {
inherit python runtimePackages;
};
unpackPhase = ''
srcDir=$out/share/spejstore
mkdir -p $srcDir
cp -r --no-preserve=mode -t $srcDir $src/{manage.py,auth,spejstore,storage,static,templates}
'';
installPhase = ''
${python.interpreter} -m compileall $srcDir
makeWrapper $pythonEnv/bin/python $out/bin/spejstore \
--add-flags $out/share/spejstore/manage.py
$out/bin/spejstore collectstatic
'';
}