privatebin

This commit is contained in:
zuckerberg 2021-05-30 22:17:01 -04:00
parent 5f6d9e5dba
commit 78bec2b695
2 changed files with 29 additions and 15 deletions

View File

@ -14,7 +14,7 @@
./server/nginx-stream.nix
./server/matrix.nix
./server/zerobin.nix
./server/privatebin.nix
./server/privatebin/privatebin.nix
./pc/de.nix
];

View File

@ -2,6 +2,18 @@
let
cfg = config.services.privatebin;
privateBinSrc = pkgs.stdenv.mkDerivation {
name = "privatebin";
src = pkgs.fetchFromGitHub {
owner = "privatebin";
repo = "privatebin";
rev = "d65bf02d7819a530c3c2a88f6f9947651fe5258d";
sha256 = "7ttAvEDL1ab0cUZcqZzXFkXwB2rF2t4eNpPxt48ap94=";
};
installPhase = ''
cp -ar $src $out
'';
};
in {
options.services.privatebin = {
enable = lib.mkEnableOption "enable privatebin";
@ -24,19 +36,12 @@ in {
services.nginx.virtualHosts.${cfg.host} = {
enableACME = true;
forceSSL = true;
locations."/" = {
root = privateBinSrc;
index = "index.php";
};
locations."~ \.php$" = {
root = lib.mkDerivation {
name = "privatebin";
src = lib.fetchFromGitHub {
owner = "privatebin";
repo = "privatebin";
rev = "d65bf02d7819a530c3c2a88f6f9947651fe5258d";
# sha256 = "";
};
installPhase = ''
cp -ar $src $out
'';
};
root = privateBinSrc;
extraConfig = ''
fastcgi_pass unix:${config.services.phpfpm.pools.privatebin.socket};
fastcgi_index index.php;
@ -45,7 +50,7 @@ in {
};
systemd.tmpfiles.rules = [
"d '/var/lib/privatebin' 0750 ${user} ${group} - -"
"d '/var/lib/privatebin' 0750 privatebin privatebin - -"
];
services.phpfpm.pools.privatebin = {
@ -54,6 +59,15 @@ in {
phpEnv = {
CONFIG_PATH = "${./conf.php}";
};
settings = {
pm = "dynamic";
"listen.owner" = config.services.nginx.user;
"pm.max_children" = 5;
"pm.start_servers" = 2;
"pm.min_spare_servers" = 1;
"pm.max_spare_servers" = 3;
"pm.max_requests" = 500;
};
};
};
}
}