betamike-infra/nixos_configs/git.nix

44 lines
1.9 KiB
Nix
Raw Normal View History

{ modulesPath, config, lib, pkgs, ... }:
let
storage-device = "/dev/disk/by-id/scsi-0DO_Volume_git-storage-1";
storage-dir = "/srv";
in
{
imports = [
"${toString modulesPath}/virtualisation/digital-ocean-image.nix"
];
fileSystems."${storage-dir}" = {
device = storage-device;
};
environment.systemPackages = with pkgs;
[ jq git gitolite lighttpd cgit ];
services.openssh.enable = true;
networking.firewall.allowedTCPPorts = [ 22 80 443 ];
users.users.root.openssh.authorizedKeys.keys = [
(builtins.readFile "/home/mike/.ssh/id_mops.pub")
];
services.gitolite = {
enable = true;
adminPubkey = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC2PjlhL4sPfuV10BeHGZysX5M9i5mIHwZ4EKi9ArauJ7z1FhGJiqlRoDgRA8RwdENfv+CayoJf6Z3Nu/U/diozqvMaQ6mXQbb3HysZ/w2ntw0d9PFYSfFIIMVUPqcECspgbolAIZHoJDLPG7dlqkJvVfAcA/uQeeLeJr3z6zp3BYs9mGZ6RYmwxo7069QimCfMb5nicLaiUnC1lXNSbK3ioPUgC5ezcgLDylXZ+zsPpZaYcl405SbAVVPYxMmQ8Yn5B+v5NN/MQSiKe3JsElWjTUlzcSKPTNZXeSN2wEILUI6UPNBkZkcycgpuJFbWJkTkNo4oUN9OsdSn7hZMlA1Q0o+JmNQJB2MdwLXb6ELRi8jkvmKeje/QFrwg/p5wBZQATRq8R9NgW7SbdmMZ5/ImD0X8afb8M43P5+5BqOYF4jjBN1MrR5vAB2FGDibgMCXwYo1cvk+VeFzc/c5YVThHArDiNsoDClhEfLaWc70NdF1LkGKhc9fZEsf2mY/1Tw7n8jBbO15nzcG4PKqp7d7d+9IwtLrk7mZ2UP+y6tl40nXCUkd8XXx70TLQZiXlM8jhWQUqLT0yBQAPXB6VUlpN4yCCi2T7Co83fG1ZLjPRxWM9k1IqxjXWVdoy5XVhEyh+eSDpgd3XFeys9gSX2wQlzodTVkMvXw7VKxoPtl8HHw== mike@betamike.com";
# need an intermediate data directory with permissions for the gitolite user
# otherwise this won't work between instances of the droplet
dataDir = "${storage-dir}/data/gitolite";
};
users.users.lighttpd.extraGroups = [ "gitolite" ];
services.lighttpd.enable = true;
services.lighttpd.cgit = {
enable = true;
configText = ''
source-filter=${pkgs.cgit}/lib/cgit/filters/syntax-highlighting.py
project-list=/srv/data/gitolite/projects.list
scan-path=/srv/data/gitolite/repositories
'';
};
}