just some boilerplate for the project
This commit is contained in:
parent
0f322fd358
commit
7bbc6ae562
|
@ -0,0 +1 @@
|
|||
__pycache__/
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"nixEnvSelector.nixFile": "${workspaceFolder}/shell.nix"
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
from flask import Flask
|
||||
from flask import request
|
||||
from flask import redirect
|
||||
from flask import abort
|
||||
|
||||
app = Flask(__name__)
|
||||
app.config.from_envvar('GIT_BRIDGE_SETTINGS')
|
||||
|
||||
@app.route("/bridge")
|
||||
def index():
|
||||
return "you've reached the main page for an internal service. congrats!"
|
|
@ -0,0 +1 @@
|
|||
SECRET_KEY="replace_me"
|
|
@ -0,0 +1,19 @@
|
|||
{ lib, pkgs, config, ... }:
|
||||
let
|
||||
cfg = config.services.gitea-github-bridge;
|
||||
appEnv = pkgs.python3.withPackages (p: with p; [ waitress (callPackage ./bridge/default.nix {}) ]);
|
||||
in {
|
||||
options.services.gitea-github-bridge = {
|
||||
enable = lib.mkEnableOption "Enable the Gitea-Github bridge";
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
systemd.services.gitea-github-bridge = {
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
serviceConfig = {
|
||||
ExecStart = "${appEnv}/bin/waitress-serve --port=8041 bridge:app";
|
||||
StandardOutput = "journal";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
{ pkgs, pythonPackages ? (import <nixpkgs> {}).python3Packages }:
|
||||
pythonPackages.buildPythonPackage {
|
||||
name = "gitea-github-bridge";
|
||||
src = ./bridge;
|
||||
|
||||
propagatedBuildInputs = [ pythonPackages.flask pythonPackages.requests ];
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p $out/${pythonPackages.python.sitePackages}
|
||||
cp -r . $out/${pythonPackages.python.sitePackages}/bridge
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
shellHook = "export FLASK_APP=bridge";
|
||||
|
||||
format = "other";
|
||||
}
|
Loading…
Reference in New Issue