@@ -337,11 +337,16 @@ in {
337337 defaultText = "pkgs.grafana";
338338 type = types.package;
339339 };
340+
340341 declarativePlugins = mkOption {
341342 type = with types; nullOr (listOf path);
342343 default = null;
343344 description = "If non-null, then a list of packages containing Grafana plugins to install. If set, plugins cannot be manually installed.";
344345 example = literalExample "with pkgs.grafanaPlugins; [ grafana-piechart-panel ]";
346+ # Make sure each plugin is added only once; otherwise building
347+ # the link farm fails, since the same path is added multiple
348+ # times.
349+ apply = x: if isList x then lib.unique x else x;
345350 };
346351
347352 dataDir = mkOption {