From 98f07d6cc5954d82d22ca40cba6fab69003d41d6 Mon Sep 17 00:00:00 2001 From: talyz Date: Fri, 4 Jun 2021 18:08:09 +0200 Subject: [PATCH] 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. --- nixos/modules/services/monitoring/grafana.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/nixos/modules/services/monitoring/grafana.nix b/nixos/modules/services/monitoring/grafana.nix index 4ebde6f9b107..1dd740014fa8 100644 --- a/nixos/modules/services/monitoring/grafana.nix +++ b/nixos/modules/services/monitoring/grafana.nix @@ -337,11 +337,16 @@ in { defaultText = "pkgs.grafana"; type = types.package; }; + declarativePlugins = mkOption { type = with types; nullOr (listOf path); default = null; description = "If non-null, then a list of packages containing Grafana plugins to install. If set, plugins cannot be manually installed."; example = literalExample "with pkgs.grafanaPlugins; [ grafana-piechart-panel ]"; + # Make sure each plugin is added only once; otherwise building + # the link farm fails, since the same path is added multiple + # times. + apply = x: if isList x then lib.unique x else x; }; dataDir = mkOption {