From 7d994ad445e4a0dac23c651ddcabbece51e76619 Mon Sep 17 00:00:00 2001 From: Antoine Eiche Date: Sat, 20 Jun 2020 09:55:02 +0200 Subject: [PATCH] nixos/nextcloud: add occ internal option This option exposes the prefconfigured nextcloud-occ program. nextcloud-occ can then be used in other systemd services or added in environment.systemPackages. The nextcloud test shows how it can be add in environment.systemPackages. --- nixos/modules/services/web-apps/nextcloud.nix | 8 ++++++++ nixos/tests/nextcloud/basic.nix | 8 +++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/nixos/modules/services/web-apps/nextcloud.nix b/nixos/modules/services/web-apps/nextcloud.nix index 5b9065dec3c5..8ce7bd521349 100644 --- a/nixos/modules/services/web-apps/nextcloud.nix +++ b/nixos/modules/services/web-apps/nextcloud.nix @@ -303,6 +303,14 @@ in { ''; }; }; + occ = mkOption { + type = types.package; + default = occ; + internal = true; + description = '' + The nextcloud-occ program preconfigured to target this Nextcloud instance. + ''; + }; }; config = mkIf cfg.enable (mkMerge [ diff --git a/nixos/tests/nextcloud/basic.nix b/nixos/tests/nextcloud/basic.nix index 9cbecf01f57b..a8fa0cae6f0f 100644 --- a/nixos/tests/nextcloud/basic.nix +++ b/nixos/tests/nextcloud/basic.nix @@ -26,7 +26,9 @@ in { }; }; - nextcloud = { config, pkgs, ... }: { + nextcloud = { config, pkgs, ... }: let + cfg = config; + in { networking.firewall.allowedTCPPorts = [ 80 ]; services.nextcloud = { @@ -42,6 +44,8 @@ in { startAt = "20:00"; }; }; + + environment.systemPackages = [ cfg.services.nextcloud.occ ]; }; }; @@ -67,6 +71,8 @@ in { in '' start_all() nextcloud.wait_for_unit("multi-user.target") + # This is just to ensure the nextcloud-occ program is working + nextcloud.succeed("nextcloud-occ status") nextcloud.succeed("curl -sSf http://nextcloud/login") nextcloud.succeed( "${withRcloneEnv} ${copySharedFile}"