mastus: use nixos gogs service
This commit is contained in:
parent
533cdabc8f
commit
81f1c549a7
@ -1,75 +1,31 @@
|
||||
{ config, pkgs, ... }:
|
||||
let
|
||||
gitHome = "/srv/git.gebner.org";
|
||||
|
||||
gogs = pkgs.callPackage ../pkgs/gogs.nix { };
|
||||
|
||||
gogsPort = 8001;
|
||||
gogsConfig = pkgs.writeText "gogs.ini" ''
|
||||
APP_NAME = Gogs: Go Git Service
|
||||
RUN_USER = git
|
||||
RUN_MODE = prod
|
||||
|
||||
[database]
|
||||
DB_TYPE = sqlite3
|
||||
HOST = 127.0.0.1:3306
|
||||
NAME = gogs
|
||||
USER = root
|
||||
PASSWD =
|
||||
SSL_MODE = disable
|
||||
PATH = ${gitHome}/data/gogs.db
|
||||
|
||||
[repository]
|
||||
ROOT = ${gitHome}/gogs-repositories
|
||||
|
||||
[server]
|
||||
DOMAIN = git.gebner.org
|
||||
HTTP_PORT = ${toString gogsPort}
|
||||
ROOT_URL = https://git.gebner.org/
|
||||
DISABLE_SSH = false
|
||||
SSH_PORT = 22
|
||||
OFFLINE_MODE = true
|
||||
|
||||
[mailer]
|
||||
ENABLED = false
|
||||
|
||||
[service]
|
||||
REGISTER_EMAIL_CONFIRM = false
|
||||
ENABLE_NOTIFY_MAIL = false
|
||||
DISABLE_REGISTRATION = true
|
||||
REQUIRE_SIGNIN_VIEW = false
|
||||
|
||||
[picture]
|
||||
DISABLE_GRAVATAR = false
|
||||
AVATAR_UPLOAD_PATH = ${gitHome}/data/avatars
|
||||
|
||||
[session]
|
||||
PROVIDER = file
|
||||
|
||||
[log]
|
||||
ROOT_PATH = ${gitHome}/logs
|
||||
MODE = file
|
||||
LEVEL = Info
|
||||
|
||||
[security]
|
||||
INSTALL_LOCK = true
|
||||
'';
|
||||
in
|
||||
{
|
||||
users.extraUsers.git = { home = gitHome; extraGroups = [ "git" ]; };
|
||||
users.extraUsers.git = { home = config.services.gogs.stateDir; extraGroups = [ "git" ]; };
|
||||
users.extraGroups.git = { };
|
||||
|
||||
systemd.services.gogs = {
|
||||
path = with pkgs; [ git openssh bash ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
serviceConfig = {
|
||||
Type = "simple";
|
||||
Restart = "always";
|
||||
User = "git";
|
||||
Group = "git";
|
||||
ExecStart = "${gogs}/gogs web -c ${gogsConfig}";
|
||||
WorkingDirectory = gitHome;
|
||||
};
|
||||
services.gogs = rec {
|
||||
enable = true;
|
||||
stateDir = "/srv/git.gebner.org";
|
||||
user = "git";
|
||||
group = "git";
|
||||
appName = "Gabriel Ebner's git server";
|
||||
domain = "git.gebner.org";
|
||||
rootUrl = "https://git.gebner.org/";
|
||||
httpPort = 8001;
|
||||
cookieSecure = true;
|
||||
extraConfig = ''
|
||||
[picture]
|
||||
DISABLE_GRAVATAR = false
|
||||
AVATAR_UPLOAD_PATH = ${stateDir}/data/avatars
|
||||
|
||||
[log]
|
||||
ROOT_PATH = ${stateDir}/logs
|
||||
MODE = file
|
||||
LEVEL = Info
|
||||
|
||||
[service]
|
||||
DISABLE_REGISTRATION = true
|
||||
'';
|
||||
};
|
||||
|
||||
services.nginx.httpConfig = ''
|
||||
@ -119,7 +75,7 @@ in
|
||||
}
|
||||
|
||||
upstream gogs {
|
||||
server 127.0.0.1:${toString gogsPort};
|
||||
server 127.0.0.1:${toString config.services.gogs.httpPort};
|
||||
}
|
||||
'';
|
||||
}
|
||||
|
@ -1,21 +0,0 @@
|
||||
{ nixpkgs ? import <nixpkgs> {} }: with nixpkgs;
|
||||
stdenv.mkDerivation rec {
|
||||
name = "gogs-${version}";
|
||||
version = "0.9.48";
|
||||
|
||||
src = fetchzip {
|
||||
url = "https://github.com/gogits/gogs/releases/download/v${version}/linux_amd64.zip";
|
||||
sha256 = "1z00lqcz7nwbyavs1mwgsr9zjnqrjjmqvxy43p8gap768y45pvlb";
|
||||
};
|
||||
|
||||
buildPhase = ''
|
||||
patchelf \
|
||||
--set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
|
||||
--set-rpath ${pam}/lib \
|
||||
gogs
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
cp -ra ./ $out/
|
||||
'';
|
||||
}
|
Loading…
Reference in New Issue
Block a user