git.iko.soy/typeable/nixpkgs
on master help sign in
nixos/grafana: set plugins path, fix image generation

Also add options to configure which organization should have anonymous access.

commitfebcd39afa6dff017290d3c56b7c545c8e05659b authorFranz Pletz <fpletz@fnordicwalking.de> dateFri 15 Jul 2016, 15:26 (10 years ago) parent07fe6fa
2 files changed+20−2
nixos/modules/services/monitoring/grafana.nix+17 pkgs/servers/monitoring/grafana/default.nix+3−2
nixos/modules/services/monitoring/grafana.nix+17
@@ -9,6 +9,7 @@ let
99
1010 envOptions = {
1111 PATHS_DATA = cfg.dataDir;
12+ PATHS_PLUGINS = "${cfg.dataDir}/plugins";
1213 PATHS_LOGS = "${cfg.dataDir}/log";
1314
1415 SERVER_PROTOCOL = cfg.protocol;
@@ -37,6 +38,8 @@ let
3738 USERS_AUTO_ASSIGN_ORG_ROLE = cfg.users.autoAssignOrgRole;
3839
3940 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;
4043
4144 ANALYTICS_REPORTING_ENABLED = b2s cfg.analytics.reporting.enable;
4245 } // cfg.extraOptions;
@@ -196,6 +199,17 @@ in {
196199 default = false;
197200 type = types.bool;
198201 };
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+
199213 };
200214
201215 analytics.reporting = {
@@ -222,6 +236,8 @@ in {
222236 "Grafana passwords will be stored as plaintext in the Nix store!"
223237 ];
224238
239+ environment.systemPackages = [ cfg.package ];
240+
225241 systemd.services.grafana = {
226242 description = "Grafana Service Daemon";
227243 wantedBy = ["multi-user.target"];
@@ -234,6 +250,7 @@ in {
234250 };
235251 preStart = ''
236252 ln -fs ${cfg.package}/share/grafana/conf ${cfg.dataDir}
253+ ln -fs ${cfg.package}/share/grafana/vendor ${cfg.dataDir}
237254 '';
238255 };
239256
pkgs/servers/monitoring/grafana/default.nix+3−2
@@ -1,4 +1,4 @@
1−{ lib, buildGoPackage, fetchurl, fetchFromGitHub }:
1+{ lib, buildGoPackage, fetchurl, fetchFromGitHub, phantomjs2 }:
22
33buildGoPackage rec {
44 version = "3.1.0";
@@ -22,7 +22,8 @@ buildGoPackage rec {
2222 postInstall = ''
2323 tar -xvf $srcStatic
2424 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
2627 '';
2728
2829 meta = with lib; {