git.iko.soy/typeable/nixpkgs
on master help sign in
nixos/grafana: set plugins path, fix image generation
febcd39Franz Pletz
nixos/modules/services/monitoring/grafana.nix+17
@@ -9,6 +9,7 @@ let
9
9
10 envOptions = {
10 envOptions = {
11 PATHS_DATA = cfg.dataDir;
11 PATHS_DATA = cfg.dataDir;
12+ PATHS_PLUGINS = "${cfg.dataDir}/plugins";
12 PATHS_LOGS = "${cfg.dataDir}/log";
13 PATHS_LOGS = "${cfg.dataDir}/log";
13
14
14 SERVER_PROTOCOL = cfg.protocol;
15 SERVER_PROTOCOL = cfg.protocol;
@@ -37,6 +38,8 @@ let
37 USERS_AUTO_ASSIGN_ORG_ROLE = cfg.users.autoAssignOrgRole;
38 USERS_AUTO_ASSIGN_ORG_ROLE = cfg.users.autoAssignOrgRole;
38
39
39 AUTH_ANONYMOUS_ENABLED = b2s cfg.auth.anonymous.enable;
40 AUTH_ANONYMOUS_ENABLED = b2s cfg.auth.anonymous.enable;
41+ AUTH_ANONYMOUS_ORG_NAME = cfg.auth.anonymous.org_name;
42+ AUTH_ANONYMOUS_ORG_ROLE = cfg.auth.anonymous.org_role;
40
43
41 ANALYTICS_REPORTING_ENABLED = b2s cfg.analytics.reporting.enable;
44 ANALYTICS_REPORTING_ENABLED = b2s cfg.analytics.reporting.enable;
42 } // cfg.extraOptions;
45 } // cfg.extraOptions;
@@ -196,6 +199,17 @@ in {
196 default = false;
199 default = false;
197 type = types.bool;
200 type = types.bool;
198 };
201 };
202+ org_name = mkOption {
203+ description = "Which organization to allow anonymous access to";
204+ default = "Main Org.";
205+ type = types.str;
206+ };
207+ org_role = mkOption {
208+ description = "Which role anonymous users have in the organization";
209+ default = "Viewer";
210+ type = types.str;
211+ };
212+
199 };
213 };
200
214
201 analytics.reporting = {
215 analytics.reporting = {
@@ -222,6 +236,8 @@ in {
222 "Grafana passwords will be stored as plaintext in the Nix store!"
236 "Grafana passwords will be stored as plaintext in the Nix store!"
223 ];
237 ];
224
238
239+ environment.systemPackages = [ cfg.package ];
240+
225 systemd.services.grafana = {
241 systemd.services.grafana = {
226 description = "Grafana Service Daemon";
242 description = "Grafana Service Daemon";
227 wantedBy = ["multi-user.target"];
243 wantedBy = ["multi-user.target"];
@@ -234,6 +250,7 @@ in {
234 };
250 };
235 preStart = ''
251 preStart = ''
236 ln -fs ${cfg.package}/share/grafana/conf ${cfg.dataDir}
252 ln -fs ${cfg.package}/share/grafana/conf ${cfg.dataDir}
253+ ln -fs ${cfg.package}/share/grafana/vendor ${cfg.dataDir}
237 '';
254 '';
238 };
255 };
239
256
pkgs/servers/monitoring/grafana/default.nix+3−2
@@ -1,4 +1,4 @@
1−{ lib, buildGoPackage, fetchurl, fetchFromGitHub }:
1+{ lib, buildGoPackage, fetchurl, fetchFromGitHub, phantomjs2 }:
2
2
3buildGoPackage rec {
3buildGoPackage rec {
4 version = "3.1.0";
4 version = "3.1.0";
@@ -22,7 +22,8 @@ buildGoPackage rec {
22 postInstall = ''
22 postInstall = ''
23 tar -xvf $srcStatic
23 tar -xvf $srcStatic
24 mkdir -p $bin/share/grafana
24 mkdir -p $bin/share/grafana
25− mv grafana-*/{public,conf} $bin/share/grafana/
25+ mv grafana-*/{public,conf,vendor} $bin/share/grafana/
26+ ln -sf ${phantomjs2}/bin/phantomjs $bin/share/grafana/vendor/phantomjs/phantomjs
26 '';
27 '';
27
28
28 meta = with lib; {
29 meta = with lib; {