Compare commits
4
Commits
f70b5ce461
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1fd6ca81c1 | ||
|
|
168027d85b | ||
|
|
7347608697 | ||
|
|
a5ff69ead4 |
@@ -9,7 +9,7 @@ From Debian to NixOS
|
||||
--------------------
|
||||
|
||||
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
|
||||
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
|
||||
|
||||
+54
-8
@@ -16,13 +16,21 @@
|
||||
};
|
||||
};
|
||||
|
||||
boot.cleanTmpDir = true;
|
||||
boot.tmp.cleanOnBoot = true;
|
||||
|
||||
# Network configuration
|
||||
networking = {
|
||||
hostName = "vps-15813cea";
|
||||
useDHCP = false;
|
||||
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.allowedTCPPortRanges = [ { from = 40000; to = 49999; } ];
|
||||
};
|
||||
@@ -38,13 +46,17 @@
|
||||
# OpenSSH daemon
|
||||
services.openssh = {
|
||||
enable = true;
|
||||
passwordAuthentication = false;
|
||||
settings.PasswordAuthentication = false;
|
||||
listenAddresses = [
|
||||
{ addr = "0.0.0.0"; }
|
||||
{ addr = "::"; }
|
||||
];
|
||||
};
|
||||
|
||||
# Let's Encrypt certificates
|
||||
security.acme = {
|
||||
acceptTerms = true;
|
||||
email = "manu@beffara.org";
|
||||
defaults.email = "manu@beffara.org";
|
||||
};
|
||||
|
||||
# Nginx web server
|
||||
@@ -62,6 +74,12 @@
|
||||
forceSSL = true;
|
||||
enableACME = true;
|
||||
};
|
||||
|
||||
virtualHosts."git.beffara.org" = {
|
||||
forceSSL = true;
|
||||
enableACME = true;
|
||||
locations."/".proxyPass = "http://unix:/run/gitea/gitea.sock:/";
|
||||
};
|
||||
};
|
||||
|
||||
# Nextcloud
|
||||
@@ -69,7 +87,7 @@
|
||||
enable = true;
|
||||
hostName = "cloud.beffara.org";
|
||||
https = true;
|
||||
package = pkgs.nextcloud21;
|
||||
package = pkgs.nextcloud34;
|
||||
home = "/data/web/nextcloud";
|
||||
|
||||
autoUpdateApps = {
|
||||
@@ -78,16 +96,19 @@
|
||||
};
|
||||
|
||||
config = {
|
||||
overwriteProtocol = "https";
|
||||
dbtype = "pgsql";
|
||||
dbuser = "nextcloud";
|
||||
dbhost = "/run/postgresql"; # nextcloud will add /.s.PGSQL.5432 by itself
|
||||
dbname = "nextcloud";
|
||||
dbpassFile = "/data/web/nextcloud/db-pass";
|
||||
defaultPhoneRegion = "FR";
|
||||
adminpassFile = "/data/web/nextcloud/admin-pass";
|
||||
adminuser = "admin";
|
||||
};
|
||||
|
||||
settings = {
|
||||
overwriteprotocol = "https";
|
||||
default_phone_region = "FR";
|
||||
};
|
||||
};
|
||||
|
||||
# Ensure that postgres is running before setting up Nextcloud
|
||||
@@ -99,15 +120,40 @@
|
||||
# PostgreSQL database
|
||||
services.postgresql = {
|
||||
enable = true;
|
||||
ensureDatabases = [ "nextcloud" ];
|
||||
package = pkgs.postgresql_16;
|
||||
ensureDatabases = [
|
||||
"gitea"
|
||||
"nextcloud"
|
||||
];
|
||||
ensureUsers = [
|
||||
{
|
||||
name = "gitea";
|
||||
ensureDBOwnership = true;
|
||||
}
|
||||
{
|
||||
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
|
||||
users.users.manu = {
|
||||
isNormalUser = true;
|
||||
|
||||
Reference in New Issue
Block a user