Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: b2787a67a6f1
Choose a base ref
...
head repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: fc1bee555ee0
Choose a head ref
  • 2 commits
  • 1 file changed
  • 3 contributors

Commits on Jan 14, 2020

  1. nixos/nginx/gitweb: add some (crucial) options

    This replaces some hardcoded values in nginx's VirtualHosts's
    configuration with customizable options. Previous values are kept as
    default, so nothing should break for existing users.
    
    Co-Authored-By: Florian Klink <flokli@flokli.de>
    ksixty and flokli committed Jan 14, 2020
    Copy the full SHA
    ed52a65 View commit details

Commits on Jan 16, 2020

  1. Merge pull request #75602 from vanyaklimenko/nginx-gitweb-more-options

    nixos/nginx/gitweb: add some (crucial) options
    aanderse authored Jan 16, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    fc1bee5 View commit details
Showing with 43 additions and 10 deletions.
  1. +43 −10 nixos/modules/services/web-servers/nginx/gitweb.nix
53 changes: 43 additions & 10 deletions nixos/modules/services/web-servers/nginx/gitweb.nix
Original file line number Diff line number Diff line change
@@ -3,8 +3,9 @@
with lib;

let
cfg = config.services.gitweb;
package = pkgs.gitweb.override (optionalAttrs cfg.gitwebTheme {
cfg = config.services.nginx.gitweb;
gitwebConfig = config.services.gitweb;
package = pkgs.gitweb.override (optionalAttrs gitwebConfig.gitwebTheme {
gitwebTheme = true;
});

@@ -17,13 +18,45 @@ in
default = false;
type = types.bool;
description = ''
If true, enable gitweb in nginx. Access it at http://yourserver/gitweb
If true, enable gitweb in nginx.
'';
};

location = mkOption {
default = "/gitweb";
type = types.str;
description = ''
Location to serve gitweb on.
'';
};

user = mkOption {
default = "nginx";
type = types.str;
description = ''
Existing user that the CGI process will belong to. (Default almost surely will do.)
'';
};

group = mkOption {
default = "nginx";
type = types.str;
description = ''
Group that the CGI process will belong to. (Set to <literal>config.services.gitolite.group</literal> if you are using gitolite.)
'';
};

virtualHost = mkOption {
default = "_";
type = types.str;
description = ''
VirtualHost to serve gitweb on. Default is catch-all.
'';
};

};

config = mkIf config.services.nginx.gitweb.enable {
config = mkIf cfg.enable {

systemd.services.gitweb = {
description = "GitWeb service";
@@ -32,22 +65,22 @@ in
FCGI_SOCKET_PATH = "/run/gitweb/gitweb.sock";
};
serviceConfig = {
User = "nginx";
Group = "nginx";
User = cfg.user;
Group = cfg.group;
RuntimeDirectory = [ "gitweb" ];
};
wantedBy = [ "multi-user.target" ];
};

services.nginx = {
virtualHosts.default = {
locations."/gitweb/static/" = {
virtualHosts.${cfg.virtualHost} = {
locations."${cfg.location}/static/" = {
alias = "${package}/static/";
};
locations."/gitweb/" = {
locations."${cfg.location}/" = {
extraConfig = ''
include ${pkgs.nginx}/conf/fastcgi_params;
fastcgi_param GITWEB_CONFIG ${cfg.gitwebConfigFile};
fastcgi_param GITWEB_CONFIG ${gitwebConfig.gitwebConfigFile};
fastcgi_pass unix:/run/gitweb/gitweb.sock;
'';
};