From ecf8ac8c5d2e73a9534e87c2f01caa0694de33ed Mon Sep 17 00:00:00 2001 From: Chris Toph Date: Mon, 2 Sep 2024 14:26:00 -0400 Subject: [PATCH] questionable changes. revert. --- flake.nix | 12 +++++++- nextcloud/nextcloud.nix | 63 +++++++++++++++++++++++++++++++++++++++-- 2 files changed, 72 insertions(+), 3 deletions(-) diff --git a/flake.nix b/flake.nix index a0eb9fc..57fdf9f 100644 --- a/flake.nix +++ b/flake.nix @@ -3,9 +3,13 @@ inputs = { nixpkgs.url = "nixpkgs/nixos-unstable"; + nextcloud29 = { + url = "github:nix-unstable/nextcloud"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; - outputs = { self, nixpkgs, home-manager, ... }: + outputs = { self, nixpkgs, nextcloud29, ... }: let system = "x86_64-linux"; lib = nixpkgs.lib; @@ -17,5 +21,11 @@ modules = [ ./nixos/configuration.nix ]; }; }; + nixosConfigurations = { + nix = lib.nixosSystem { + inherit system; + modules = [ ./nextcloud/nextcloud.nix ]; + }; + }; }; } diff --git a/nextcloud/nextcloud.nix b/nextcloud/nextcloud.nix index 345cb9e..d40dedc 100644 --- a/nextcloud/nextcloud.nix +++ b/nextcloud/nextcloud.nix @@ -1,5 +1,64 @@ -{ pkgs, ... }: +{ self, config, lib, pkgs, ... }: -{ +{ + services = { + nginx.virtualHosts = { + "cloud.ryot.foo" = { + forceSSL = true; + enableACME = true; + }; + "office.ryot.foo" = { + forceSSL = true; + enableACME = true; + }; + }; + + nextcloud = { + enable = true; + hostName = "cloud.ryot.foo"; + + # Need to manually increment with every major upgrade. + package = pkgs.nextcloud27; + + # Let NixOS install and configure the database automatically. + database.createLocally = true; + + # Let NixOS install and configure Redis caching automatically. + configureRedis = true; + + # Increase the maximum file upload size to avoid problems uploading videos. + maxUploadSize = "16G"; + https = true; + enableBrokenCiphersForSSE = false; + + autoUpdateApps.enable = true; + extraAppsEnable = true; + extraApps = with config.services.nextcloud.package.packages.apps; { + # List of apps we want to install and are already packaged in + # https://github.com/NixOS/nixpkgs/blob/master/pkgs/servers/nextcloud/packages/nextcloud-apps.json + inherit calendar contacts mail notes onlyoffice tasks; + + # Custom app installation example. + cookbook = pkgs.fetchNextcloudApp rec { + url = + "https://github.com/nextcloud/cookbook/releases/download/v0.10.2/Cookbook-0.10.2.tar.gz"; + sha256 = "sha256-XgBwUr26qW6wvqhrnhhhhcN4wkI+eXDHnNSm1HDbP6M="; + }; + }; + + config = { + overwriteProtocol = "https"; + defaultPhoneRegion = "PT"; + dbtype = "pgsql"; + adminuser = "admin"; + adminpassFile = "/path/to/nextcloud-admin-pass"; + }; + }; + + onlyoffice = { + enable = true; + hostname = "onlyoffice.example.com"; + }; + }; }