nixos/grafana: Filter out duplicate plugins

If the same plugin appears multiple times in `declarativePlugins`, for
example due to being added both by a module and in user config, the
build fails with an error message similar to

ln: failed to create symbolic link 'grafana-worldmap-panel/glmqcj88zk2bz3mvdr3r7920wxg02qnq-grafana-worldmap-panel-0.3.2': Permission denied

This is solved by removing all duplicates.

authored by talyz and committed by Raphael Megzari 98f07d6c 6d84e50b

+5
+5
nixos/modules/services/monitoring/grafana.nix
··· 337 337 defaultText = "pkgs.grafana"; 338 338 type = types.package; 339 339 }; 340 + 340 341 declarativePlugins = mkOption { 341 342 type = with types; nullOr (listOf path); 342 343 default = null; 343 344 description = "If non-null, then a list of packages containing Grafana plugins to install. If set, plugins cannot be manually installed."; 344 345 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; 345 350 }; 346 351 347 352 dataDir = mkOption {