We are Nix. Resistance is futile.
parent
6b5c97b638
commit
bbc6c95a5c
|
@ -0,0 +1,49 @@
|
|||
{ 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
|
||||
'';
|
||||
}
|
|
@ -0,0 +1,90 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
inherit (lib) mkIf mkOption types;
|
||||
|
||||
cfg = config.services.spejstore;
|
||||
|
||||
spejstore = (import ./default.nix);
|
||||
cfgFile = pkgs.writeText "spejstore.cfg"
|
||||
''
|
||||
SPEJSTORE_DB_NAME='${cfg.databaseName}'
|
||||
SPEJSTORE_DB_USER='${cfg.databaseUsername}'
|
||||
SPEJSTORE_DB_PASSWORD='${cfg.databasePassword}'
|
||||
SPEJSTORE_DB_HOST='${cfg.databaseHost}'
|
||||
SPEJSTORE_ALLOWED_HOSTS='${cfg.hostName}'
|
||||
SPEJSTORE_LABEL_API='${cfg.labelApiAddress}'
|
||||
SPEJSTORE_MEDIA_ROOT='${cfg.mediaRoot}'
|
||||
SPEJSTORE_CLIENT_ID='${cfg.spaceauthConsumerKey}'
|
||||
SPEJSTORE_SECRET='${cfg.spaceauthConsumerSecret}'
|
||||
'';
|
||||
|
||||
|
||||
in {
|
||||
options.services.spejstore = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Whether to enable spejstore";
|
||||
};
|
||||
spaceauthConsumerKey = mkOption {
|
||||
type = types.str;
|
||||
default = "";
|
||||
description = "spaceauth consumer key";
|
||||
};
|
||||
spaceauthConsumerSecret = mkOption {
|
||||
type = types.str;
|
||||
default = "";
|
||||
description = "spaceauth consumer secret";
|
||||
};
|
||||
hostName = mkOption {
|
||||
type = types.str;
|
||||
default = "inventory.waw.hackerspace.pl";
|
||||
description = "hostname";
|
||||
};
|
||||
listenAddress = mkOption {
|
||||
type = types.str;
|
||||
default = "127.0.0.1:8000";
|
||||
description = "Listen address for spejstore service";
|
||||
};
|
||||
labelApiAddress = mkOption {
|
||||
type = types.str;
|
||||
default = "http://label.waw.hackerspace.pl:4567";
|
||||
description = "spejstore-labelmaker instance";
|
||||
};
|
||||
mediaRoot = mkOption {
|
||||
type = types.path;
|
||||
default = "";
|
||||
description = "media storage path";
|
||||
};
|
||||
databaseName = mkOption {
|
||||
type = types.str;
|
||||
default = "spejstore";
|
||||
description = "database name";
|
||||
};
|
||||
databaseHost = mkOption {
|
||||
type = types.str;
|
||||
default = "spejstore";
|
||||
description = "database host";
|
||||
};
|
||||
databaseUsername = mkOption {
|
||||
type = types.str;
|
||||
default = "spejstore";
|
||||
description = "database username";
|
||||
};
|
||||
databasePassword = mkOption {
|
||||
type = types.str;
|
||||
default = "spejstore";
|
||||
description = "database password";
|
||||
};
|
||||
};
|
||||
config = mkIf cfg.enable {
|
||||
systemd.services.spejstore = {
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
ExecStart = ''
|
||||
${spejstore}/bin/spejstore runserver ${cfg.listenAddress}
|
||||
'';
|
||||
EnvironmentFile = [ cfgFile ];
|
||||
};
|
||||
};
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
{ buildPythonPackage, fetchurl
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "django-flat-responsive";
|
||||
version = "2.0";
|
||||
src = fetchurl {
|
||||
url = "https://files.pythonhosted.org/packages/02/c9/35732ae69908854d4ef9a2bfaa75c9ca002f62decbff711ea1c9541f1142/django-flat-responsive-2.0.tar.gz";
|
||||
sha256 = "0x3439m2bim8r0xldx99ry0fksfyv39k8bffnwpvahf500ksl725";
|
||||
};
|
||||
format = "setuptools";
|
||||
doCheck = false;
|
||||
buildInputs = [];
|
||||
checkInputs = [];
|
||||
nativeBuildInputs = [];
|
||||
propagatedBuildInputs = [];
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
{ buildPythonPackage, fetchgit
|
||||
, psycopg2
|
||||
, django-discover-runner
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "django-hstore";
|
||||
version = "1.5a0";
|
||||
src = fetchgit {
|
||||
url = "https://github.com/djangonauts/django-hstore";
|
||||
rev = "aac755f587ff8ea95c1f43e7f3df8e339b848b6b";
|
||||
sha256 = "03q3a03nngfi8x0xsja762ccdf242z29xmbl78yhz1xd6lmhj71s";
|
||||
};
|
||||
format = "setuptools";
|
||||
doCheck = false;
|
||||
buildInputs = [];
|
||||
checkInputs = [];
|
||||
nativeBuildInputs = [];
|
||||
propagatedBuildInputs = [ psycopg2 django-discover-runner ];
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
{ buildPythonPackage, fetchurl
|
||||
, markdown2
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "django-markdown2";
|
||||
version = "0.3.1";
|
||||
src = fetchurl {
|
||||
url = "https://files.pythonhosted.org/packages/f9/62/eadc690275c3a66e08e2d9b3bf5576285f0df896fc787faa45691900b2f6/django-markdown2-0.3.1.tar.gz";
|
||||
sha256 = "1qhph56bc6dkhdl086wq6h5iq3jkb0xfbw1milfjkxl8czalhizh";
|
||||
};
|
||||
format = "setuptools";
|
||||
doCheck = false;
|
||||
buildInputs = [];
|
||||
checkInputs = [];
|
||||
nativeBuildInputs = [];
|
||||
propagatedBuildInputs = [
|
||||
markdown2
|
||||
];
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
{ buildPythonPackage, fetchurl
|
||||
, django
|
||||
, django-hstore
|
||||
, djangorestframework
|
||||
, psycopg2
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "djangorestframework-hstore";
|
||||
version = "1.3";
|
||||
src = fetchurl {
|
||||
url = "https://files.pythonhosted.org/packages/f7/b0/6a921950a4afe9d2b2a521ec1336884daa713fb6a72ce60f14cd72c65c51/djangorestframework_hstore-1.3-py2.py3-none-any.whl";
|
||||
sha256 = "0pa62w5h78g1nyg6khxmzj00bziyrbcqnyqkbbfa76i9zy5aw9a8";
|
||||
};
|
||||
format = "wheel";
|
||||
doCheck = false;
|
||||
buildInputs = [];
|
||||
checkInputs = [];
|
||||
nativeBuildInputs = [];
|
||||
propagatedBuildInputs = [
|
||||
django
|
||||
django-hstore
|
||||
djangorestframework
|
||||
psycopg2
|
||||
];
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
{ buildPythonPackage, fetchurl
|
||||
, django_appconf
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "Django-Select2";
|
||||
version = "6.3.1";
|
||||
src = fetchurl {
|
||||
url = "https://files.pythonhosted.org/packages/8d/16/28b9a8cb7add7570590c2d9f0f4bc2404515eaba028820cb1bc806bedcb8/django_select2-6.3.1-py3-none-any.whl";
|
||||
sha256 = "17xqvc2wh7x89d17c24v0i9c2i6ffwqs1q4i98br9jrj8fjksnky";
|
||||
};
|
||||
format = "wheel";
|
||||
doCheck = false;
|
||||
buildInputs = [];
|
||||
checkInputs = [];
|
||||
nativeBuildInputs = [];
|
||||
propagatedBuildInputs = [
|
||||
django_appconf
|
||||
];
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
{ buildPythonPackage, fetchgit
|
||||
, django
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "django-tree";
|
||||
version = "0.1.0";
|
||||
src = fetchgit {
|
||||
url = "https://github.com/d42/django-tree";
|
||||
rev = "687c01c02d91cada9ca1912e34e482da9e73e27a";
|
||||
sha256 = "1amfj3hs8132a3nkszqwk2my8fhygwcbsy25vcbaic1jq2shy094";
|
||||
};
|
||||
format = "setuptools";
|
||||
doCheck = false;
|
||||
buildInputs = [];
|
||||
checkInputs = [];
|
||||
nativeBuildInputs = [];
|
||||
propagatedBuildInputs = [
|
||||
django
|
||||
];
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
{ buildPythonPackage, fetchurl
|
||||
, six
|
||||
, social-auth-core
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "social-auth-app-django";
|
||||
version = "3.1.0";
|
||||
src = fetchurl {
|
||||
url = "https://files.pythonhosted.org/packages/9f/13/3be586914f69fe9d11beee01b938d329589045dfe90076529c82dae97578/social_auth_app_django-3.1.0-py3-none-any.whl";
|
||||
sha256 = "1qwsx35qncdjwdja1lfr7b9wjsgwdv70qbmhqfa99xgnnvby6dwj";
|
||||
};
|
||||
format = "wheel";
|
||||
doCheck = false;
|
||||
buildInputs = [];
|
||||
checkInputs = [];
|
||||
nativeBuildInputs = [];
|
||||
propagatedBuildInputs = [
|
||||
six
|
||||
social-auth-core
|
||||
];
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
{ buildPythonPackage, fetchurl
|
||||
, pyjwt
|
||||
, defusedxml
|
||||
, oauthlib
|
||||
, python3-openid
|
||||
, requests
|
||||
, requests_oauthlib
|
||||
, six
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "social-auth-core";
|
||||
version = "3.2.0";
|
||||
src = fetchurl {
|
||||
url = "https://files.pythonhosted.org/packages/1a/06/146938c323cf08f87158841518d5db96588ef7826e84a2a5ad66ca798c8b/social_auth_core-3.2.0-py3-none-any.whl";
|
||||
sha256 = "1w5hjwx2x2407rbzfsabicfvdn1aw11lcl8cdd305zgyr1c29ka7";
|
||||
};
|
||||
format = "wheel";
|
||||
doCheck = false;
|
||||
buildInputs = [];
|
||||
checkInputs = [];
|
||||
nativeBuildInputs = [];
|
||||
propagatedBuildInputs = [
|
||||
pyjwt
|
||||
defusedxml
|
||||
oauthlib
|
||||
python3-openid
|
||||
requests
|
||||
requests_oauthlib
|
||||
six
|
||||
];
|
||||
}
|
Loading…
Reference in New Issue