The TomOpt software package is designed to optimise the geometric configuration and the specifications of detectors intended for muon scattering tomography, an imaging technique exploiting cosmic-ray muons. The software employs an end-to-end differentiable pipeline that models the interactions of muons with detectors and scanned volumes, infers properties of the scanned materials, and performs an optimisation cycle minimising a user-defined loss function. This article presents the implementation of a case study related to cargo scanning applications in the context of homeland security.