diff options
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/module-list.nix | 3 | ||||
-rw-r--r-- | nixos/modules/sites/cgit.nix | 102 | ||||
-rw-r--r-- | nixos/modules/sites/go.nix | 52 | ||||
-rw-r--r-- | nixos/modules/sites/recipes.nix | 32 |
4 files changed, 0 insertions, 189 deletions
diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 43de9f8..a734519 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -22,8 +22,5 @@ ./services/snapclient.nix ./services/ssh.nix ./services/upmpdcli.nix - ./sites/cgit.nix - ./sites/go.nix - ./sites/recipes.nix ./users/eth.nix ] diff --git a/nixos/modules/sites/cgit.nix b/nixos/modules/sites/cgit.nix deleted file mode 100644 index b43faa4..0000000 --- a/nixos/modules/sites/cgit.nix +++ /dev/null @@ -1,102 +0,0 @@ -{ config, lib, pkgs, ... }: -with lib; - -let - cfg = config.eth.sites.cgit; - fcgi = config.services.fcgiwrap; - - cgitConfig = pkgs.writeText "cgitrc" '' - cache-size=1000 - virtual-root=/ - - about-filter=${cfg.aboutFilter} - source-filter=${cfg.sourceFilter} - - remove-suffix=1 - - enable-git-config=1 - #enable-gitweb-owner=1 - project-list=${cfg.projectList} - scan-path=${cfg.scanPath} - - enable-blame=1 - enable-follow-links=1 - enable-index-owner=0 - - enable-http-clone=1 - - snapshots=tar.gz zip - - ${cfg.extraConfig} - ''; - -in { - options.eth.sites.cgit = { - enable = mkEnableOption "Whether to enable cgit."; - - https = mkOption { - type = types.bool; - default = true; - description = "Whether to enable HTTPS."; - }; - - virtualHost = mkOption { - type = types.str; - default = "_"; - description = "Virtual Host to install the site under in Nginx."; - example = "git.eth.moe"; - }; - - aboutFilter = mkOption { - type = types.path; - default = "${pkgs.cgit}/lib/cgit/filters/about-formatting.sh"; - }; - sourceFilter = mkOption { - type = types.path; - default = "${pkgs.cgit}/lib/cgit/filters/syntax-highlighting.py"; - }; - - scanPath = mkOption { - type = types.path; - description = "Path to search for Git repositories under."; - example = "${config.services.gitolite.dataDir}/repositories/"; - }; - projectList = mkOption { - type = types.path; - description = "Path to a list of Git repositories to search for."; - example = "${config.services.gitolite.dataDir}/projects.list"; - }; - - extraConfig = mkOption { - type = types.str; - default = ""; - }; - }; - - config = mkIf cfg.enable { - services.nginx.virtualHosts.${cfg.virtualHost} = { - forceSSL = cfg.https; - enableACME = cfg.https; - - root = "${pkgs.cgit}/cgit/"; - extraConfig = '' - try_files $uri @cgit; - - location @cgit { - include ${pkgs.nginx}/conf/fastcgi_params; - fastcgi_param CGIT_CONFIG ${cgitConfig}; - fastcgi_param HTTP_HOST $server_name; - fastcgi_param PATH_INFO $uri; - fastcgi_param QUERY_STRING $args; - fastcgi_param SCRIPT_FILENAME ${pkgs.cgit}/cgit/cgit.cgi; - - fastcgi_pass unix:${fcgi.socketAddress}; - } - ''; - }; - - services.fcgiwrap = { - enable = true; - }; - }; -} diff --git a/nixos/modules/sites/go.nix b/nixos/modules/sites/go.nix deleted file mode 100644 index 7682469..0000000 --- a/nixos/modules/sites/go.nix +++ /dev/null @@ -1,52 +0,0 @@ -{ config, lib, pkgs, ... }: -with lib; - -let - cfg = config.eth.sites.go; - - mkLocation = virtualHost: module: url: { - name = "/${module}"; - value = { - extraConfig = '' - if ($args = "go-get=1") { - add_header Content-Type text/html; - return 200 '<meta name="go-import" content="${virtualHost}/${module} git ${url}">'; - } - return 302 ${url}; - ''; - }; - }; - -in { - options.eth.sites.go = { - enable = mkEnableOption "Whether to enable the Go site."; - - https = mkOption { - type = types.bool; - default = true; - description = "Whether to enable HTTPS."; - }; - - virtualHost = mkOption { - type = types.str; - default = "_"; - description = "Virtual Host to install the site under in Nginx."; - example = "go.eth.moe"; - }; - - modules = mkOption { - type = types.attrsOf types.str; - description = "A set of modules and their underlying git repos."; - example = { catbus = "https://git.eth.moe/go-catbus"; }; - }; - }; - - config = mkIf cfg.enable { - services.nginx.virtualHosts.${cfg.virtualHost} = { - forceSSL = cfg.https; - enableACME = cfg.https; - - locations = listToAttrs (mapAttrsToList (mkLocation cfg.virtualHost) cfg.modules); - }; - }; -} diff --git a/nixos/modules/sites/recipes.nix b/nixos/modules/sites/recipes.nix deleted file mode 100644 index 2312e56..0000000 --- a/nixos/modules/sites/recipes.nix +++ /dev/null @@ -1,32 +0,0 @@ -{ config, lib, pkgs, ... }: -with lib; - -let - cfg = config.eth.sites.recipes; - -in { - options.eth.sites.recipes = { - enable = mkEnableOption "Whether to enable recipes."; - - https = mkOption { - type = types.bool; - default = true; - description = "Whether to enable HTTPS."; - }; - - virtualHost = mkOption { - type = types.str; - default = "_"; - description = "Virtual Host to install the site under in Nginx."; - example = "git.eth.moe"; - }; - }; - - config = mkIf cfg.enable { - services.nginx.virtualHosts.${cfg.virtualHost} = { - forceSSL = cfg.https; - enableACME = cfg.https; - root = "${pkgs.eth.recipes}"; - }; - }; -} |