default.nix: implement
This paves the way to hosting bitvend with NixOS. Getting this to work required pulling in flask-oauthlib and a bunch of older dependencies. This isn't great, but before we migrate flask-spaceauth to use authlib that's what we have to do. We also build pigpio/cygpio. pigpio should get upstreamed into nixpkgs. We also rename bitvend.py to bitvend-run.py to unconfuse python paths. To test: nix build result/bin/bitvend-run.pymaster
parent
9ea05b5c70
commit
75c222852b
|
@ -2,3 +2,4 @@
|
|||
*.cfg
|
||||
*.db
|
||||
*.sqlite3
|
||||
result
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
graft bitvend/static
|
||||
graft bitvend/templates
|
||||
global-exclude *.pyc
|
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import logging
|
||||
|
||||
logging.basicConfig(level=logging.INFO) # noqa
|
|
@ -1,3 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
import cachetools
|
||||
import requests
|
||||
|
||||
|
|
|
@ -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
|
||||
];
|
||||
}
|
|
@ -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]
|
||||
|
|
Loading…
Reference in New Issue