add functions to easily create siteconfigs
This commit is contained in:
parent
d12ff9e7c6
commit
2593b09878
3 changed files with 50 additions and 1 deletions
24
PHP-FPM/mksiteconfig.nix
Normal file
24
PHP-FPM/mksiteconfig.nix
Normal file
|
@ -0,0 +1,24 @@
|
|||
{ PHPFPMSiteConfig
|
||||
}:
|
||||
{ PHPFPMConfig
|
||||
, PHPFPMService
|
||||
, name
|
||||
, siteName
|
||||
, siteRoot
|
||||
, socketUser
|
||||
, socketGroup
|
||||
}:
|
||||
rec {
|
||||
inherit name;
|
||||
siteSocket = "/run/php-fpm/${name}.sock";
|
||||
pkg = PHPFPMSiteConfig {
|
||||
inherit (PHPFPMConfig) siteConfigDir;
|
||||
inherit (PHPFPMService) user group;
|
||||
inherit siteSocket socketUser socketGroup;
|
||||
|
||||
service = siteName;
|
||||
serviceRoot = siteRoot;
|
||||
allowedClients = "127.0.0.1";
|
||||
};
|
||||
type = "fileset";
|
||||
}
|
|
@ -8,16 +8,18 @@
|
|||
let
|
||||
callPackage = pkgs.lib.callPackageWith (pkgs // self);
|
||||
|
||||
self = {
|
||||
self = rec {
|
||||
PostgresDB = callPackage ./PostgresDB {};
|
||||
|
||||
CaddyConfig = callPackage ./caddy/config.nix {inherit utils;};
|
||||
CaddyService = callPackage ./caddy/unit.nix {inherit utils;};
|
||||
CaddySiteConfig = callPackage ./caddy/siteconfig.nix {inherit utils;};
|
||||
mkCaddySiteConfig = callPackage ./caddy/mksiteconfig.nix {inherit CaddySiteConfig;};
|
||||
|
||||
PHPFPMConfig = callPackage ./PHP-FPM/config.nix {inherit utils;};
|
||||
PHPFPMService = callPackage ./PHP-FPM/unit.nix {inherit utils;};
|
||||
PHPFPMSiteConfig = callPackage ./PHP-FPM/siteconfig.nix {inherit utils;};
|
||||
mkPHPFPMSiteConfig = callPackage ./PHP-FPM/mksiteconfig.nix {inherit PHPFPMSiteConfig;};
|
||||
|
||||
TtrssEnvironment = callPackage ./Ttrss/environment.nix {};
|
||||
TtrssConfig = callPackage ./Ttrss/config.nix {};
|
||||
|
|
23
caddy/mksiteconfig.nix
Normal file
23
caddy/mksiteconfig.nix
Normal file
|
@ -0,0 +1,23 @@
|
|||
{ CaddySiteConfig
|
||||
}:
|
||||
{ CaddyConfig
|
||||
, CaddyService
|
||||
, name
|
||||
, port
|
||||
, siteName
|
||||
, siteRoot
|
||||
, siteSocket ? ""
|
||||
}:
|
||||
{
|
||||
inherit name;
|
||||
pkg = CaddySiteConfig rec {
|
||||
inherit (CaddyConfig) siteConfigDir;
|
||||
|
||||
portBinding = port;
|
||||
bindService = siteName;
|
||||
siteSocket = "${CaddyService.runtimeDirectory}/${siteName}.sock";
|
||||
serviceRoot = siteRoot;
|
||||
phpFpmSiteSocket = siteSocket;
|
||||
};
|
||||
type = "fileset";
|
||||
}
|
Loading…
Reference in a new issue