diff --git a/hosts/global.nix b/hosts/global.nix index b05ed31..e2074bf 100644 --- a/hosts/global.nix +++ b/hosts/global.nix @@ -49,10 +49,13 @@ nixpkgs.config.allowUnfree = true; - nix.settings.experimental-features = [ - "nix-command" - "flakes" - ]; + nix.settings = { + download-buffer-size = 16777216; + experimental-features = [ + "nix-command" + "flakes" + ]; + }; programs = { zsh.enable = true; diff --git a/hosts/server/configuration.nix b/hosts/server/configuration.nix index eb36fb7..7285e4f 100644 --- a/hosts/server/configuration.nix +++ b/hosts/server/configuration.nix @@ -9,6 +9,7 @@ ../../services/discord.nix ../../services/games.nix ../../services/web.nix + ../../services/self_host.nix ]; networking = { @@ -19,6 +20,9 @@ }; service = { + selfhost = { + nextcloud = true; + }; forty_two.irc = true; web.portefolio = true; minecraft = { diff --git a/services/self_host.nix b/services/self_host.nix new file mode 100644 index 0000000..fbb4315 --- /dev/null +++ b/services/self_host.nix @@ -0,0 +1,26 @@ +{ inputs, config, pkgs, lib, ... }: + +let + nextcloud = import ./self_host/nextcloud.nix { + inherit inputs config pkgs lib; + }; + cfg = config.service.selfhost; +in +{ + imports = [ + nextcloud + ]; + + config = { + services.nginx = { + enable = true; + }; + }; + options.service.selfhost = { + nextcloud = lib.mkOption { + type = lib.types.bool; + default = false; + description = "Enable the nextcloud"; + }; + }; +} diff --git a/services/self_host/nextcloud.nix b/services/self_host/nextcloud.nix new file mode 100644 index 0000000..13c8032 --- /dev/null +++ b/services/self_host/nextcloud.nix @@ -0,0 +1,30 @@ +{ config, pkgs, lib, ... }: + +let + cfg = config.service.selfhost.nextcloud; + dataDir = "/mnt/data/nextcloud"; +in +{ + environment.systemPackages = with pkgs; [ + php + ]; + services = { + nextcloud = { + enable = true; + https = true; + package = pkgs.nextcloud31; + hostName = "nextcloud.enium.eu"; + datadir = "/mnt/data/nextcloud/"; + config = { + adminpassFile = "/etc/nextcloud-pass.txt"; + adminuser = "OwnedByTheEniumTeam"; + dbtype = "sqlite"; + }; + }; + nginx.virtualHosts."nextcloud.enium.eu".enableACME = true; + nginx.virtualHosts."nextcloud.enium.eu".forceSSL = true; + nginx.virtualHosts."nextcloud.enium.eu".locations."~ \.php$".extraConfig = '' + fastcgi_pass unix:/run/phpfpm-nextcloud.sock; + ''; + }; +}