summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--MANIFEST.in3
-rw-r--r--bitvend-run.py (renamed from bitvend.py)2
-rw-r--r--bitvend/utils.py2
-rw-r--r--default.nix128
-rw-r--r--deployment/bitvend.service2
-rw-r--r--setup.py9
7 files changed, 146 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
index 85ea788..c5ec480 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,4 @@
*.cfg
*.db
*.sqlite3
+result
diff --git a/MANIFEST.in b/MANIFEST.in
new file mode 100644
index 0000000..0b89ab0
--- /dev/null
+++ b/MANIFEST.in
@@ -0,0 +1,3 @@
+graft bitvend/static
+graft bitvend/templates
+global-exclude *.pyc
diff --git a/bitvend.py b/bitvend-run.py
index 589ad98..0cbd89a 100644
--- a/bitvend.py
+++ b/bitvend-run.py
@@ -1,3 +1,5 @@
+#!/usr/bin/env python3
+
import logging
logging.basicConfig(level=logging.INFO) # noqa
diff --git a/bitvend/utils.py b/bitvend/utils.py
index e761f4a..24914cf 100644
--- a/bitvend/utils.py
+++ b/bitvend/utils.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
import cachetools
import requests
diff --git a/default.nix b/default.nix
new file mode 100644
index 0000000..3afa202
--- /dev/null
+++ b/default.nix
@@ -0,0 +1,128 @@
+with import <nixpkgs> {};
+
+let
+ upstream = with pkgs.python3Packages; {
+ inherit buildPythonPackage;
+ inherit fetchPypi;
+
+ inherit blinker;
+ inherit cachetools;
+ inherit cryptography;
+ inherit cython;
+ inherit flask;
+ inherit flask_login;
+ inherit flask_sqlalchemy;
+ inherit flask_wtf;
+ inherit mock;
+ inherit prometheus_client;
+ inherit pyjwt;
+ inherit pytest;
+ inherit qrcode;
+ inherit requests;
+ inherit six;
+ };
+
+in with upstream; let
+ websocket_client = buildPythonPackage rec {
+ version = "0.40.0";
+ pname = "websocket_client";
+
+ src = fetchPypi {
+ inherit pname version;
+ sha256 = "1yz67wdjijrvwpx0a0f6wdfy8ajsvr9xbj5514ld452fqnh19b20";
+ };
+
+ propagatedBuildInputs = [
+ six
+ ];
+ };
+
+ oauthlib = buildPythonPackage rec {
+ pname = "oauthlib";
+ version = "2.1.0";
+ src = fetchPypi {
+ inherit pname version;
+ sha256 = "0qj183fipjzw6ipiv2k10896y97sxvargnkb6db5qs61c5d6cddc";
+ };
+
+ checkInputs = [ mock pytest ];
+ propagatedBuildInputs = [ cryptography blinker pyjwt ];
+
+ checkPhase = ''
+ py.test tests/
+ '';
+ };
+
+ requests_oauthlib = buildPythonPackage rec {
+ pname = "requests-oauthlib";
+ version = "1.0.0";
+ src = fetchPypi {
+ inherit pname version;
+ sha256 = "0gys581rqjdlv0whhqp5s2caxx66jzvb2hslxn8v7bypbbnbz1l8";
+ };
+
+ doCheck = false;
+ propagatedBuildInputs = [ oauthlib requests ];
+ };
+
+ flask_oauthlib = buildPythonPackage rec {
+ pname = "Flask-OAuthlib";
+ version = "0.9.5";
+ src = fetchPypi {
+ inherit pname version;
+ sha256 = "01llysn53jfrr9n02hvjcynrb28lh4rjqn18k2hhk6an09cq7znb";
+ };
+
+ doCheck = false;
+ propagatedBuildInputs = [ flask flask_sqlalchemy requests_oauthlib oauthlib ];
+ };
+
+ spaceauth = buildPythonPackage rec {
+ pname = "Flask-SpaceAuth";
+ version = "0.2.0";
+
+ src = pkgs.fetchgit {
+ url = "https://code.hackerspace.pl/informatic/flask-spaceauth";
+ rev = "v${version}";
+ sha256 = "000vg41lw4pyd10bvcqrp15y673qlpkllgppfhm48w7vk02r6zi2";
+ };
+
+ propagatedBuildInputs = [ flask flask_login flask_oauthlib flask_wtf requests ];
+ };
+
+ pigpio = stdenv.mkDerivation rec {
+ pname = "pigpio";
+ version = "74";
+ installFlags = [ "DESTDIR=$(out)" "prefix=" ];
+
+ src = pkgs.fetchFromGitHub {
+ owner = "joan2937";
+ repo = "pigpio";
+ rev = "v${version}";
+ sha256 = "1arq051dbki50rwhzdxjba3ispnl4vdw7mr244f5hmrk0p34frcy";
+ };
+ };
+
+ cygpio = buildPythonPackage {
+ pname = "cygpio";
+ version = "1.0.0";
+ src = ./cygpio;
+ propagatedBuildInputs = [ pigpio cython ];
+ };
+
+in buildPythonPackage rec {
+ name = "bitvend";
+ src = ./.;
+ doCheck = false;
+ propagatedBuildInputs = [
+ cygpio
+ flask
+ flask_sqlalchemy
+ websocket_client
+ cachetools
+ requests
+ prometheus_client
+ spaceauth
+ qrcode
+ ];
+}
diff --git a/deployment/bitvend.service b/deployment/bitvend.service
index 1bac993..826515b 100644
--- a/deployment/bitvend.service
+++ b/deployment/bitvend.service
@@ -7,7 +7,7 @@ Type=simple
User=bitvend
Environment=BITVEND_SETTINGS=bitvend.cfg
WorkingDirectory=/var/bitvend
-ExecStart=/usr/bin/python3 -u /var/bitvend/bitvend.py
+ExecStart=/usr/bin/python3 -u /var/bitvend/bitvend-run.py
Restart=on-failure
[Install]
diff --git a/setup.py b/setup.py
new file mode 100644
index 0000000..eb8c91b
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,9 @@
+from setuptools import setup, find_packages
+
+setup(
+ name="bitvend",
+ version="1.0",
+ packages=find_packages(),
+ include_package_data=True,
+ scripts=['bitvend-run.py'],
+)