gitweb: use common options
This commit is contained in:
parent
69a0c9721e
commit
2821d3fed7
@ -325,6 +325,7 @@
|
|||||||
#./services/misc/gitit.nix
|
#./services/misc/gitit.nix
|
||||||
./services/misc/gitlab.nix
|
./services/misc/gitlab.nix
|
||||||
./services/misc/gitolite.nix
|
./services/misc/gitolite.nix
|
||||||
|
./services/misc/gitweb.nix
|
||||||
./services/misc/gogs.nix
|
./services/misc/gogs.nix
|
||||||
./services/misc/gollum.nix
|
./services/misc/gollum.nix
|
||||||
./services/misc/gpsd.nix
|
./services/misc/gpsd.nix
|
||||||
|
|||||||
50
nixos/modules/services/misc/gitweb.nix
Normal file
50
nixos/modules/services/misc/gitweb.nix
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
|
||||||
|
let
|
||||||
|
cfg = config.services.gitweb;
|
||||||
|
|
||||||
|
in
|
||||||
|
{
|
||||||
|
|
||||||
|
options.services.gitweb = {
|
||||||
|
|
||||||
|
projectroot = mkOption {
|
||||||
|
default = "/srv/git";
|
||||||
|
type = types.path;
|
||||||
|
description = ''
|
||||||
|
Path to git projects (bare repositories) that should be served by
|
||||||
|
gitweb. Must not end with a slash.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
extraConfig = mkOption {
|
||||||
|
default = "";
|
||||||
|
type = types.lines;
|
||||||
|
description = ''
|
||||||
|
Verbatim configuration text appended to the generated gitweb.conf file.
|
||||||
|
'';
|
||||||
|
example = ''
|
||||||
|
$feature{'highlight'}{'default'} = [1];
|
||||||
|
$feature{'ctags'}{'default'} = [1];
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
gitwebConfigFile = mkOption {
|
||||||
|
default = pkgs.writeText "gitweb.conf" ''
|
||||||
|
# path to git projects (<project>.git)
|
||||||
|
$projectroot = "${cfg.projectroot}";
|
||||||
|
$highlight_bin = "${pkgs.highlight}/bin/highlight";
|
||||||
|
${cfg.extraConfig}
|
||||||
|
'';
|
||||||
|
type = types.path;
|
||||||
|
readOnly = true;
|
||||||
|
internal = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
meta.maintainers = with maintainers; [ gnidorah ];
|
||||||
|
|
||||||
|
}
|
||||||
@ -3,13 +3,7 @@
|
|||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
cfg = config.services.lighttpd.gitweb;
|
cfg = config.services.gitweb;
|
||||||
gitwebConfigFile = pkgs.writeText "gitweb.conf" ''
|
|
||||||
# path to git projects (<project>.git)
|
|
||||||
$projectroot = "${cfg.projectroot}";
|
|
||||||
$highlight_bin = "${pkgs.highlight}/bin/highlight";
|
|
||||||
${cfg.extraConfig}
|
|
||||||
'';
|
|
||||||
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
@ -24,30 +18,9 @@ in
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
projectroot = mkOption {
|
|
||||||
default = "/srv/git";
|
|
||||||
type = types.path;
|
|
||||||
description = ''
|
|
||||||
Path to git projects (bare repositories) that should be served by
|
|
||||||
gitweb. Must not end with a slash.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
extraConfig = mkOption {
|
|
||||||
default = "";
|
|
||||||
type = types.lines;
|
|
||||||
description = ''
|
|
||||||
Verbatim configuration text appended to the generated gitweb.conf file.
|
|
||||||
'';
|
|
||||||
example = ''
|
|
||||||
$feature{'highlight'}{'default'} = [1];
|
|
||||||
$feature{'ctags'}{'default'} = [1];
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf config.services.lighttpd.gitweb.enable {
|
||||||
|
|
||||||
# declare module dependencies
|
# declare module dependencies
|
||||||
services.lighttpd.enableModules = [ "mod_cgi" "mod_redirect" "mod_alias" "mod_setenv" ];
|
services.lighttpd.enableModules = [ "mod_cgi" "mod_redirect" "mod_alias" "mod_setenv" ];
|
||||||
@ -65,7 +38,7 @@ in
|
|||||||
"/gitweb/" => "${pkgs.git}/share/gitweb/gitweb.cgi"
|
"/gitweb/" => "${pkgs.git}/share/gitweb/gitweb.cgi"
|
||||||
)
|
)
|
||||||
setenv.add-environment = (
|
setenv.add-environment = (
|
||||||
"GITWEB_CONFIG" => "${gitwebConfigFile}",
|
"GITWEB_CONFIG" => "${cfg.gitwebConfigFile}",
|
||||||
"HOME" => "${cfg.projectroot}"
|
"HOME" => "${cfg.projectroot}"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,13 +3,7 @@
|
|||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
cfg = config.services.nginx.gitweb;
|
cfg = config.services.gitweb;
|
||||||
gitwebConfigFile = pkgs.writeText "gitweb.conf" ''
|
|
||||||
# path to git projects (<project>.git)
|
|
||||||
$projectroot = "${cfg.projectroot}";
|
|
||||||
$highlight_bin = "${pkgs.highlight}/bin/highlight";
|
|
||||||
${cfg.extraConfig}
|
|
||||||
'';
|
|
||||||
gitwebPerlLibs = with pkgs.perlPackages; [ CGIFast FCGI FCGIProcManager HTMLTagCloud ];
|
gitwebPerlLibs = with pkgs.perlPackages; [ CGIFast FCGI FCGIProcManager HTMLTagCloud ];
|
||||||
git = pkgs.git.overrideAttrs (oldAttrs: rec {
|
git = pkgs.git.overrideAttrs (oldAttrs: rec {
|
||||||
postInstall = ''
|
postInstall = ''
|
||||||
@ -34,30 +28,9 @@ in
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
projectroot = mkOption {
|
|
||||||
default = "/srv/git";
|
|
||||||
type = types.path;
|
|
||||||
description = ''
|
|
||||||
Path to git projects (bare repositories) that should be served by
|
|
||||||
gitweb. Must not end with a slash.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
extraConfig = mkOption {
|
|
||||||
default = "";
|
|
||||||
type = types.lines;
|
|
||||||
description = ''
|
|
||||||
Verbatim configuration text appended to the generated gitweb.conf file.
|
|
||||||
'';
|
|
||||||
example = ''
|
|
||||||
$feature{'highlight'}{'default'} = [1];
|
|
||||||
$feature{'ctags'}{'default'} = [1];
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf config.services.nginx.gitweb.enable {
|
||||||
|
|
||||||
systemd.sockets.gitweb = {
|
systemd.sockets.gitweb = {
|
||||||
description = "GitWeb Listen Socket";
|
description = "GitWeb Listen Socket";
|
||||||
@ -87,7 +60,7 @@ in
|
|||||||
root = "${pkgs.git}/share/gitweb";
|
root = "${pkgs.git}/share/gitweb";
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
include ${pkgs.nginx}/conf/fastcgi_params;
|
include ${pkgs.nginx}/conf/fastcgi_params;
|
||||||
fastcgi_param GITWEB_CONFIG ${gitwebConfigFile};
|
fastcgi_param GITWEB_CONFIG ${cfg.gitwebConfigFile};
|
||||||
fastcgi_pass unix:/run/gitweb.sock;
|
fastcgi_pass unix:/run/gitweb.sock;
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user