Compare commits

...
4 Commits
Author SHA1 Message Date
manu 1fd6ca81c1 Upgrade to NixOS 26.05, Postgres 16 and Nextcloud 34 2026-08-26 11:26:02 +02:00
manu 168027d85b Fix a typo in the README 2024-07-05 14:29:29 +02:00
manu 7347608697 Adjust for nixos-23.05 2024-07-05 14:29:08 +02:00
manu a5ff69ead4 Enable Gitea 2024-03-25 08:47:26 +01:00
2 changed files with 55 additions and 9 deletions
+1 -1
View File
@@ -9,7 +9,7 @@ From Debian to NixOS
-------------------- --------------------
Out of the box, the server came with a Debian 10 installation, OVH does not Out of the box, the server came with a Debian 10 installation, OVH does not
offer NixOS as an option for their servers. The part of the dicumentation on offer NixOS as an option for their servers. The part of the documentation on
[Installing from another Linux [Installing from another Linux
distribution](https://nixos.org/nixos/manual/index.html#sec-installing-from-other-distro) distribution](https://nixos.org/nixos/manual/index.html#sec-installing-from-other-distro)
on the same partition did work fine. The call to `nixos-generate-config` made on the same partition did work fine. The call to `nixos-generate-config` made
+54 -8
View File
@@ -16,13 +16,21 @@
}; };
}; };
boot.cleanTmpDir = true; boot.tmp.cleanOnBoot = true;
# Network configuration # Network configuration
networking = { networking = {
hostName = "vps-15813cea"; hostName = "vps-15813cea";
useDHCP = false; useDHCP = false;
interfaces.ens3.useDHCP = true; interfaces.ens3.useDHCP = true;
interfaces.ens3.ipv6.addresses = [ {
address = "2001:41d0:305:2100::3276";
prefixLength = 64;
} ];
defaultGateway6 = {
address = "2001:41d0:305:2100::1";
interface = "ens3";
};
firewall.allowedTCPPorts = [ 22 80 443 ]; firewall.allowedTCPPorts = [ 22 80 443 ];
firewall.allowedTCPPortRanges = [ { from = 40000; to = 49999; } ]; firewall.allowedTCPPortRanges = [ { from = 40000; to = 49999; } ];
}; };
@@ -38,13 +46,17 @@
# OpenSSH daemon # OpenSSH daemon
services.openssh = { services.openssh = {
enable = true; enable = true;
passwordAuthentication = false; settings.PasswordAuthentication = false;
listenAddresses = [
{ addr = "0.0.0.0"; }
{ addr = "::"; }
];
}; };
# Let's Encrypt certificates # Let's Encrypt certificates
security.acme = { security.acme = {
acceptTerms = true; acceptTerms = true;
email = "manu@beffara.org"; defaults.email = "manu@beffara.org";
}; };
# Nginx web server # Nginx web server
@@ -62,6 +74,12 @@
forceSSL = true; forceSSL = true;
enableACME = true; enableACME = true;
}; };
virtualHosts."git.beffara.org" = {
forceSSL = true;
enableACME = true;
locations."/".proxyPass = "http://unix:/run/gitea/gitea.sock:/";
};
}; };
# Nextcloud # Nextcloud
@@ -69,7 +87,7 @@
enable = true; enable = true;
hostName = "cloud.beffara.org"; hostName = "cloud.beffara.org";
https = true; https = true;
package = pkgs.nextcloud21; package = pkgs.nextcloud34;
home = "/data/web/nextcloud"; home = "/data/web/nextcloud";
autoUpdateApps = { autoUpdateApps = {
@@ -78,16 +96,19 @@
}; };
config = { config = {
overwriteProtocol = "https";
dbtype = "pgsql"; dbtype = "pgsql";
dbuser = "nextcloud"; dbuser = "nextcloud";
dbhost = "/run/postgresql"; # nextcloud will add /.s.PGSQL.5432 by itself dbhost = "/run/postgresql"; # nextcloud will add /.s.PGSQL.5432 by itself
dbname = "nextcloud"; dbname = "nextcloud";
dbpassFile = "/data/web/nextcloud/db-pass"; dbpassFile = "/data/web/nextcloud/db-pass";
defaultPhoneRegion = "FR";
adminpassFile = "/data/web/nextcloud/admin-pass"; adminpassFile = "/data/web/nextcloud/admin-pass";
adminuser = "admin"; adminuser = "admin";
}; };
settings = {
overwriteprotocol = "https";
default_phone_region = "FR";
};
}; };
# Ensure that postgres is running before setting up Nextcloud # Ensure that postgres is running before setting up Nextcloud
@@ -99,15 +120,40 @@
# PostgreSQL database # PostgreSQL database
services.postgresql = { services.postgresql = {
enable = true; enable = true;
ensureDatabases = [ "nextcloud" ]; package = pkgs.postgresql_16;
ensureDatabases = [
"gitea"
"nextcloud"
];
ensureUsers = [ ensureUsers = [
{
name = "gitea";
ensureDBOwnership = true;
}
{ {
name = "nextcloud"; name = "nextcloud";
ensurePermissions."DATABASE nextcloud" = "ALL PRIVILEGES"; ensureDBOwnership = true;
} }
]; ];
}; };
# Gitea
services.gitea = {
enable = true;
appName = "Gitea on beffara.org";
database = {
passwordFile = "/data/gitea/db-pass";
type = "postgres";
};
mailerPasswordFile = "/data/gitea/mailer-pass";
repositoryRoot = "/data/gitea/repositories";
stateDir = "/data/gitea";
settings.server = {
DOMAIN = "git.beffara.org";
PROTOCOL = "http+unix";
};
};
# Initial user account # Initial user account
users.users.manu = { users.users.manu = {
isNormalUser = true; isNormalUser = true;