git.iko.soy/typeable/nixpkgs
on master help sign in
tt-rss service: #15862 has been merged; enable nginx virtualhost config
commit789a37f0fc279ac74ea605ce721d154da98301fa authorNadrieril <nadrieril@gmail.com> dateSat 27 Aug 2016, 12:20 (10 years ago) parent33d6371
1 file changed+28−43
nixos/modules/services/web-apps/tt-rss.nix+28−43
nixos/modules/services/web-apps/tt-rss.nix+28−43
@@ -18,7 +18,6 @@ let
1818
1919 poolName = "tt-rss";
2020 phpfpmSocketName = "/var/run/phpfpm/${poolName}.sock";
21− virtualHostName = "tt-rss";
2221
2322 tt-rss-config = pkgs.writeText "config.php" ''
2423 <?php
@@ -119,17 +118,13 @@ let
119118 '';
120119 };
121120
122− # TODO: Re-enable after https://github.com/NixOS/nixpkgs/pull/15862 is merged
123−
124− # virtualHost = mkOption {
125− # type = types.str;
126− # default = "${virtualHostName}";
127− # description = ''
128− # Name of existing nginx virtual host that is used to run web-application.
129− # If not specified a host will be created automatically with
130− # default values.
131− # '';
132− # };
121+ virtualHost = mkOption {
122+ type = types.nullOr types.str;
123+ default = "tt-rss";
124+ description = ''
125+ Name of the nginx virtualhost to use and setup. If null, do not setup any virtualhost.
126+ '';
127+ };
133128
134129 database = {
135130 type = mkOption {
@@ -456,7 +451,7 @@ let
456451
457452 config = mkIf cfg.enable {
458453
459− services.phpfpm.poolConfigs = if cfg.pool == "${poolName}" then {
454+ services.phpfpm.poolConfigs = mkIf (cfg.pool == "${poolName}") {
460455 "${poolName}" = ''
461456 listen = "${phpfpmSocketName}";
462457 listen.owner = nginx
@@ -471,36 +466,26 @@ let
471466 pm.max_requests = 500
472467 catch_workers_output = 1
473468 '';
474− } else {};
475−
476− # TODO: Re-enable after https://github.com/NixOS/nixpkgs/pull/15862 is merged
477−
478− # services.nginx.virtualHosts = if cfg.virtualHost == "${virtualHostName}" then {
479− # "${virtualHostName}" = {
480− # root = "${root}";
481− # extraConfig = ''
482− # access_log /var/log/nginx-${virtualHostName}-access.log;
483− # error_log /var/log/nginx-${virtualHostName}-error.log;
484− # '';
485−
486− # locations."/" = {
487− # extraConfig = ''
488− # index index.php;
489− # '';
490− # };
491−
492− # locations."~ \.php$" = {
493− # extraConfig = ''
494− # fastcgi_split_path_info ^(.+\.php)(/.+)$;
495− # fastcgi_pass unix:${phpfpmSocketName};
496− # fastcgi_index index.php;
497− # fastcgi_param SCRIPT_FILENAME ${root}/$fastcgi_script_name;
498−
499− # include ${pkgs.nginx}/conf/fastcgi_params;
500− # '';
501− # };
502− # };
503− # } else {};
469+ };
470+
471+ services.nginx.virtualHosts = mkIf (cfg.virtualHost != null) {
472+ "${cfg.virtualHost}" = {
473+ root = "${cfg.root}";
474+
475+ locations."/" = {
476+ index = "index.php";
477+ };
478+
479+ locations."~ \.php$" = {
480+ extraConfig = ''
481+ fastcgi_split_path_info ^(.+\.php)(/.+)$;
482+ fastcgi_pass unix:${phpfpmSocketName};
483+ fastcgi_index index.php;
484+ fastcgi_param SCRIPT_FILENAME ${cfg.root}/$fastcgi_script_name;
485+ '';
486+ };
487+ };
488+ };
504489
505490
506491 systemd.services.tt-rss = let