git.iko.soy/typeable/nixpkgs
on master help sign in
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.

commit98f07d6cc5954d82d22ca40cba6fab69003d41d6 authortalyz <kim.lindberger@gmail.com> dateFri 4 Jun 2021, 18:08 (5 years ago) parent6d84e50
1 file changed+5
nixos/modules/services/monitoring/grafana.nix+5
nixos/modules/services/monitoring/grafana.nix+5
@@ -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 {