mirror of https://gerrit.hackerspace.pl/hscloud
hswaw/machines/customs: rework checkinator build
Change-Id: I4ec569c5966f65f46f48a3707842a1fe9d483e16 Reviewed-on: https://gerrit.hackerspace.pl/c/hscloud/+/1171 Reviewed-by: informatic <informatic@hackerspace.pl>changes/71/1171/5
parent
6f6187c61c
commit
6c69fcdbc9
|
@ -1,14 +1,7 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
let
|
||||
old-pkgs = import (fetchTarball {
|
||||
sha256 = "0kdx3pz0l422d0vvvj3h8mnq65jcg2scb13dc1z1lg2a8cln842z";
|
||||
url = https://api.github.com/repos/NixOS/nixpkgs/tarball/0bf298df24f721a7f85c580339fb7eeff64b927c;
|
||||
}) { config = pkgs.config; };
|
||||
|
||||
repo = pkgs.fetchgit (builtins.fromJSON
|
||||
(builtins.readFile ./checkinator-repo.json));
|
||||
checkinator = old-pkgs.callPackage "${repo}/default.nix" {};
|
||||
checkinator = pkgs.callPackage ./checkinator.nix {};
|
||||
|
||||
name = "checkinator-tracker";
|
||||
user = name;
|
||||
|
|
|
@ -1,23 +1,16 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
let
|
||||
old-pkgs = import (fetchTarball {
|
||||
sha256 = "0kdx3pz0l422d0vvvj3h8mnq65jcg2scb13dc1z1lg2a8cln842z";
|
||||
url = https://api.github.com/repos/NixOS/nixpkgs/tarball/0bf298df24f721a7f85c580339fb7eeff64b927c;
|
||||
}) { config = pkgs.config; };
|
||||
|
||||
repo = pkgs.fetchgit (builtins.fromJSON
|
||||
(builtins.readFile ./checkinator-repo.json));
|
||||
checkinator = old-pkgs.callPackage "${repo}/default.nix" {};
|
||||
checkinator = pkgs.callPackage ./checkinator.nix {};
|
||||
|
||||
name = "checkinator-web";
|
||||
user = name;
|
||||
group = name;
|
||||
socket_dir = "/run/${name}/";
|
||||
|
||||
python = old-pkgs.python3.withPackages (ppackages: with ppackages; [
|
||||
python = pkgs.python3.withPackages (ppackages: with ppackages; [
|
||||
checkinator
|
||||
old-pkgs.python3Packages.gunicorn
|
||||
pkgs.python3Packages.gunicorn
|
||||
]);
|
||||
|
||||
prepare = pkgs.writeShellScriptBin "${name}-prepare" ''
|
||||
|
@ -101,7 +94,7 @@ in {
|
|||
"${pkgs.writeShellScript "checkinator-dbsetup" ''
|
||||
if [ ! -e "/var/checkinator-web/at.db" ]
|
||||
then
|
||||
${pkgs.sqlite}/bin/sqlite3 /var/checkinator-web/at.db < ${repo}/dbsetup.sql
|
||||
${pkgs.sqlite}/bin/sqlite3 /var/checkinator-web/at.db < ${checkinator}/dbsetup.sql
|
||||
fi
|
||||
''}"
|
||||
];
|
||||
|
@ -118,7 +111,7 @@ in {
|
|||
enableACME = true;
|
||||
|
||||
locations."/static/" = {
|
||||
alias = "${repo}/static/";
|
||||
alias = "${checkinator}/static/";
|
||||
};
|
||||
locations."/" = {
|
||||
proxyPass = "http://unix://${socket_dir}/web.sock";
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
diff --git a/at/web.py b/at/web.py
|
||||
index 34b6337..9eb5e6a 100644
|
||||
--- a/at/web.py
|
||||
+++ b/at/web.py
|
||||
@@ -54,7 +54,7 @@ def app(instance_path, devices_api, config):
|
||||
app.updater = devices_api
|
||||
|
||||
if app.config.get('PROXY_FIX'):
|
||||
- from werkzeug.contrib.fixers import ProxyFix
|
||||
+ from werkzeug.middleware.proxy_fix import ProxyFix
|
||||
app.wsgi_app = ProxyFix(app.wsgi_app)
|
||||
|
||||
app.space_auth = SpaceAuth(app)
|
|
@ -0,0 +1,39 @@
|
|||
{ pkgs }:
|
||||
|
||||
let
|
||||
spaceauth = pkgs.callPackage "${pkgs.fetchgit {
|
||||
url = "https://code.hackerspace.pl/informatic/flask-spaceauth";
|
||||
rev = "d3e1a4412cbc929249e407ccecfb54fbbd14e53a";
|
||||
sha256 = "01qnjj647jw81hcyvq359rwqjpc5ah9ghvc6ic0a0wppp13mgw94";
|
||||
}}" {};
|
||||
in pkgs.python3Packages.buildPythonPackage {
|
||||
pname = "checkinator";
|
||||
version = "0.2";
|
||||
|
||||
doCheck = false;
|
||||
src = pkgs.fetchgit (builtins.fromJSON (builtins.readFile ./checkinator-repo.json));
|
||||
|
||||
patches = [
|
||||
./checkinator-werkzeug.patch
|
||||
];
|
||||
|
||||
postInstall = ''
|
||||
cp -r dbsetup.sql $out/dbsetup.sql
|
||||
cp -r static $out/static
|
||||
'';
|
||||
|
||||
propagatedBuildInputs = with pkgs; [
|
||||
python3Packages.gunicorn
|
||||
python3Packages.flask
|
||||
python3Packages.pyyaml
|
||||
python3Packages.isodate
|
||||
python3Packages.requests
|
||||
python3Packages.requests-unixsocket
|
||||
python3Packages.grpcio
|
||||
python3Packages.grpcio-tools
|
||||
python3Packages.setuptools
|
||||
python3Packages.protobuf
|
||||
spaceauth
|
||||
iproute
|
||||
];
|
||||
}
|
Loading…
Reference in New Issue