Nextcloud can't find ffmpeg

I have a nix file added to my config that creates my nextcloud instance. I also have ffmpeg installed under environment.systemPackages. From the terminal, I can run ffmpeg and it runs just fine. But an app inside Nextcloud (Automated media conversion) relies on finding ffmpeg, and it doesn’t seem to see it. Do I somehow need to add ffmpeg into my nextcloud nix setup for it to find it?

{ config, pkgs, ... }:

{
 
  environment.etc."nextcloud-admin-pass".text = "PWD";
  services.nextcloud = {                
    enable = true;                   
    package = pkgs.nextcloud31;
    hostName = "nextcloud.mydomain.io";
    https = true;
    config.adminpassFile = "/etc/nextcloud-admin-pass";
    config.dbtype = "mysql";
    config.dbuser = "nextcloud";
    config.dbname = "nextcloud";
    config.adminuser = "root";
    configureRedis = true;
  };

  services.mysql = {
    enable = true;
    ensureDatabases = [ "nextcloud" ];
    ensureUsers = [
     { name = "nextcloud";
       ensurePermissions = { "nextcloud.*" = "ALL PRIVILEGES";};
     }
    ];
    package = pkgs.mariadb;
  };

  systemd.services."nextcloud-setup" = {
    requires = ["mysql.service"];
    after = ["mysql.service"];
  };

}

that is weird… it looks like it should work :thinking:

what do your error logs say?

Thanks for any help on this

{“reqId”:“sGHqDBNIhtuqsbTSDZ8e”,“level”:3,“time”:“2025-03-11T12:37:21-04:00”,“remoteAddr”:“”,“user”:false,“app”:“workflow_media_converter”,“method”:“”,“url”:“–”,“message”:“[Symfony\Component\Process\Exception\ProcessFailedException] :: (0) :: The command "umask 0077 && ffmpeg -threads 0 -i /tmp/oc_tmp_VtWR03-.mp4 /tmp/oc_tmp_VtWR03-out.m4v" failed.\n\nExit Code: 127(Command not found)\n\nWorking directory: /\n\nOutput:\n================\n\n\nError Output:\n================\nsh: line 1: ffmpeg: command not found\n :: #0 /var/lib/nextcloud/store-apps/workflow_media_converter/lib/BackgroundJobs/ConvertMediaJob.php(68): OCA\WorkflowMediaConverter\BackgroundJobs\ConvertMediaJob->convertMedia()\n#1 /nix/store/w8wz187nmb72ank55p8gdrwfg6vczq9h-nextcloud-31.0.0/lib/public/BackgroundJob/Job.php(61): OCA\WorkflowMediaConverter\BackgroundJobs\ConvertMediaJob->run(Array)\n#2 /nix/store/w8wz187nmb72ank55p8gdrwfg6vczq9h-nextcloud-31.0.0/lib/public/BackgroundJob/QueuedJob.php(43): OCP\BackgroundJob\Job->start(Object(OC\BackgroundJob\JobList))\n#3 /nix/store/w8wz187nmb72ank55p8gdrwfg6vczq9h-nextcloud-31.0.0/lib/public/BackgroundJob/QueuedJob.php(29): OCP\BackgroundJob\QueuedJob->start(Object(OC\BackgroundJob\JobList))\n#4 /nix/store/w8wz187nmb72ank55p8gdrwfg6vczq9h-nextcloud-31.0.0/cron.php(168): OCP\BackgroundJob\QueuedJob->execute(Object(OC\BackgroundJob\JobList))\n#5 {main}”,“userAgent”:“–”,“version”:“31.0.0.18”,“data”:{“app”:“workflow_media_converter”},“id”:“67d06734d61cc”}

i didn’t realize this ran as a “background job” - that means it isn’t the php-fpm service and environment which executes this command, it is a systemd service

it might be worth a PR to the nextcloud module to unify the environments - in the meantime you can adjust this service in your configuration.nix like so:

systemd.services.nextcloud-cron.path = [ pkgs.ffmpeg ];

i’m somewhat sure that should do it…


alternatively you can set the path of ffmpeg in the settings

1 Like

That fixed it! Thank you so much.