config/profiles/http/services/sourcegraph.nix

48 lines
1.5 KiB
Nix
Raw Permalink Normal View History

2023-02-25 00:03:29 +01:00
{ config, pkgs, lib, mkDomain, ... }:
{
# Sourcegraph
# Understand, fix, and automate across your codebase with this code intelligence platform
/** /
# First user regitration becomes admin
# data can be destryoed with `nixos-container destroy sourcegraph`
virtualisation.oci-containers.containers."sourcegraph" = {
autoStart = true;
#image = "sourcegraph/server:3.41.0";
#image = "sourcegraph/server:latest";
image = "sourcegraph/server:insiders";
environment = {};
ports = [
"127.0.0.1:7080:7080/tcp" # webui?
"127.0.0.1:3370:3370/tcp" # admin? (graphana and stuff)
];
volumes = [
"/var/lib/sourcegraph/config:/etc/sourcegraph"
"/var/lib/sourcegraph/data:/var/opt/sourcegraph"
];
};
systemd.services."create-sourcegraph-volume-dirs" = {
wantedBy = [ "${config.virtualisation.oci-containers.backend}-sourcegraph.service" ];
serviceConfig.Type = "oneshot";
script = ''
mkdir -p /var/lib/sourcegraph/config
mkdir -p /var/lib/sourcegraph/data
'';
};
services.nginx.virtualHosts.${mkDomain "sourcegraph"}
= lib.mkIf config.virtualisation.oci-containers.containers."sourcegraph".autoStart {
forceSSL = true; # addSSL = true;
enableACME = true; #useACMEHost = acmeDomain;
locations."/" = {
proxyPass = "http://127.0.0.1:7080";
proxyWebsockets = true;
};
#locations."/graphana/" = {
# proxyPass = "http://127.0.0.1:3370";
# proxyWebsockets = true;
#};
};
/**/
}