Compare commits
4
Commits
f70b5ce461
...
1fd6ca81c1
| 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
|
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
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user