nixos/nextcloud: Add services.nextcloud.imaginary.enable option

This commit is contained in:
provokateurin
2025-11-11 22:55:03 +01:00
parent 15b3b037b6
commit 7559f30acc
@@ -956,6 +956,24 @@ in
Only has an effect in Nextcloud 23 and later.
'';
};
enabledPreviewProviders = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [
"OC\\Preview\\PNG"
"OC\\Preview\\JPEG"
"OC\\Preview\\GIF"
"OC\\Preview\\BMP"
"OC\\Preview\\XBitmap"
"OC\\Preview\\Krita"
"OC\\Preview\\WebP"
"OC\\Preview\\MarkDown"
"OC\\Preview\\TXT"
"OC\\Preview\\OpenDocument"
];
description = ''
The preview providers that should be explicitly enabled.
'';
};
};
};
default = { };
@@ -1025,6 +1043,8 @@ in
The value can be customized for `nextcloud-cron.service` using this option.
'';
};
imaginary.enable = lib.mkEnableOption "Imaginary";
};
config = lib.mkIf cfg.enable (
@@ -1461,6 +1481,20 @@ in
port = 0;
};
})
# https://docs.nextcloud.com/server/latest/admin_manual/installation/server_tuning.html#previews
(lib.mkIf cfg.imaginary.enable {
preview_imaginary_url = "http://${config.services.imaginary.address}:${toString config.services.imaginary.port}";
# Imaginary replaces a few of the built-in providers, so the default value has to be adjusted.
enabledPreviewProviders = lib.mkDefault [
"OC\\Preview\\Imaginary"
"OC\\Preview\\ImaginaryPDF"
"OC\\Preview\\Krita"
"OC\\Preview\\MarkDown"
"OC\\Preview\\TXT"
"OC\\Preview\\OpenDocument"
];
})
];
};
@@ -1593,6 +1627,13 @@ in
''}
'';
};
services.imaginary = lib.mkIf cfg.imaginary.enable {
enable = true;
# add -return-size flag recommend by Nextcloud
# https://github.com/h2non/imaginary/pull/382
settings.return-size = true;
};
}
]
);