Add new gitea
This commit is contained in:
parent
1f8bfa1136
commit
e9ce88b058
|
@ -4,6 +4,7 @@
|
||||||
environment.systemPackages = with pkgs; [ git curl ];
|
environment.systemPackages = with pkgs; [ git curl ];
|
||||||
programs.neovim.enable = true;
|
programs.neovim.enable = true;
|
||||||
programs.neovim.viAlias = true;
|
programs.neovim.viAlias = true;
|
||||||
|
programs.neovim.vimAlias = true;
|
||||||
programs.fish.shellInit = "set -U fish_greeting";
|
programs.fish.shellInit = "set -U fish_greeting";
|
||||||
|
|
||||||
users.defaultUserShell = pkgs.fish;
|
users.defaultUserShell = pkgs.fish;
|
||||||
|
|
12
flake.nix
12
flake.nix
|
@ -24,12 +24,12 @@
|
||||||
packages.x86_64-linux.register = let
|
packages.x86_64-linux.register = let
|
||||||
lxc = nixos-generators.nixosGenerate {
|
lxc = nixos-generators.nixosGenerate {
|
||||||
pkgs = pkgs;
|
pkgs = pkgs;
|
||||||
modules = [ ./machines/base.nix ];
|
modules = [ ./machines/base ];
|
||||||
format = "lxc";
|
format = "lxc";
|
||||||
};
|
};
|
||||||
metadata = nixos-generators.nixosGenerate {
|
metadata = nixos-generators.nixosGenerate {
|
||||||
pkgs = pkgs;
|
pkgs = pkgs;
|
||||||
modules = [ ./machines/base.nix ];
|
modules = [ ./machines/base ];
|
||||||
format = "lxc-metadata";
|
format = "lxc-metadata";
|
||||||
};
|
};
|
||||||
in with import nixpkgs { system = "x86_64-linux"; };
|
in with import nixpkgs { system = "x86_64-linux"; };
|
||||||
|
@ -61,6 +61,14 @@
|
||||||
tags = [ "database" ];
|
tags = [ "database" ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
gitea = {
|
||||||
|
imports = [ ./machines/gitea ];
|
||||||
|
deployment = {
|
||||||
|
targetUser = "jdejeu";
|
||||||
|
targetHost = "gitea.lxd";
|
||||||
|
tags = [ "website" "system" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
devShells.x86_64-linux.default = pkgs.mkShell {
|
devShells.x86_64-linux.default = pkgs.mkShell {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{ config, pkgs, ... }: {
|
{ config, pkgs, ... }: {
|
||||||
imports = [ ../common ../common/lxc.nix ];
|
imports = [ ../../common ../../common/lxc.nix ];
|
||||||
networking.hostName = "base";
|
networking.hostName = "base";
|
||||||
system.stateVersion = "21.11";
|
system.stateVersion = "21.11";
|
||||||
}
|
}
|
40
machines/gitea/default.nix
Normal file
40
machines/gitea/default.nix
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
{ config, pkgs, ... }: {
|
||||||
|
imports = [ ../../common ../../common/lxc.nix ];
|
||||||
|
networking.hostName = "gitea";
|
||||||
|
system.stateVersion = "21.11";
|
||||||
|
|
||||||
|
environment.systemPackages = with pkgs; [ gnupg unzip ];
|
||||||
|
|
||||||
|
networking.firewall.enable = false;
|
||||||
|
networking.firewall.allowedTCPPorts = [ 3000 ];
|
||||||
|
services.openssh.permitRootLogin = "no";
|
||||||
|
services.openssh.passwordAuthentication = false;
|
||||||
|
|
||||||
|
# The db can only be accessed from the machine anyways
|
||||||
|
# so the password is just set to x
|
||||||
|
environment.etc.giteaPass = {
|
||||||
|
enable = true;
|
||||||
|
text = "x";
|
||||||
|
};
|
||||||
|
|
||||||
|
services.gitea = {
|
||||||
|
enable = true;
|
||||||
|
ssh = { clonePort = 4321; };
|
||||||
|
lfs.enable = true;
|
||||||
|
|
||||||
|
appName = "Voidcorp Gitea";
|
||||||
|
domain = "git.asraphiel.dev";
|
||||||
|
rootUrl = "https://git.asraphiel.dev/";
|
||||||
|
database = {
|
||||||
|
type = "postgres";
|
||||||
|
host = "postgres.lxd";
|
||||||
|
name = "gitea";
|
||||||
|
user = "gitea";
|
||||||
|
passwordFile = "/etc/giteaPass";
|
||||||
|
createDatabase = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
cookieSecure = true;
|
||||||
|
disableRegistration = true;
|
||||||
|
};
|
||||||
|
}
|
|
@ -17,6 +17,15 @@
|
||||||
enableACME = true;
|
enableACME = true;
|
||||||
root = "/etc/main";
|
root = "/etc/main";
|
||||||
};
|
};
|
||||||
|
virtualHosts."git.asraphiel.dev" = {
|
||||||
|
forceSSL = true;
|
||||||
|
enableACME = true;
|
||||||
|
http2 = true;
|
||||||
|
locations."/" = {
|
||||||
|
proxyPass = "http://gitea.lxd:3000";
|
||||||
|
proxyWebsockets = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
security.acme.email = "acme@voidcorp.nl";
|
security.acme.email = "acme@voidcorp.nl";
|
||||||
security.acme.acceptTerms = true;
|
security.acme.acceptTerms = true;
|
||||||
|
|
|
@ -3,18 +3,27 @@
|
||||||
networking.hostName = "postgres";
|
networking.hostName = "postgres";
|
||||||
system.stateVersion = "21.11";
|
system.stateVersion = "21.11";
|
||||||
|
|
||||||
|
environment.systemPackages = with pkgs; [ rsync ];
|
||||||
|
|
||||||
networking.firewall.enable = true;
|
networking.firewall.enable = true;
|
||||||
networking.firewall.allowedTCPPorts = [ 5432 ];
|
networking.firewall.allowedTCPPorts = [ 5432 ];
|
||||||
|
|
||||||
services.postgresql = {
|
services.postgresql = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
package = pkgs.postgresql_13;
|
||||||
# yes scuffed, but technically lxd can do whatever with the ip's it gives
|
# yes scuffed, but technically lxd can do whatever with the ip's it gives
|
||||||
authentication = "host all all 10.0.0.0/24 trust";
|
authentication = ''
|
||||||
|
local all all trust
|
||||||
|
host all all 10.0.0.0/8 trust
|
||||||
|
'';
|
||||||
ensureDatabases = [ "gitea" ];
|
ensureDatabases = [ "gitea" ];
|
||||||
ensureUsers = [{
|
ensureUsers = [
|
||||||
|
{
|
||||||
name = "gitea";
|
name = "gitea";
|
||||||
ensurePermissions = { "DATABASE \"gitea\"" = "ALL PRIVILEGES"; };
|
ensurePermissions = { "DATABASE \"gitea\"" = "ALL PRIVILEGES"; };
|
||||||
}];
|
}
|
||||||
|
];
|
||||||
|
|
||||||
enableTCPIP = true;
|
enableTCPIP = true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue