nixos/grafana: set plugins path, fix image generation
Also add options to configure which organization should have anonymous access.
This commit is contained in:
parent
07fe6fa90e
commit
febcd39afa
2 changed files with 20 additions and 2 deletions
|
@ -9,6 +9,7 @@ let
|
||||||
|
|
||||||
envOptions = {
|
envOptions = {
|
||||||
PATHS_DATA = cfg.dataDir;
|
PATHS_DATA = cfg.dataDir;
|
||||||
|
PATHS_PLUGINS = "${cfg.dataDir}/plugins";
|
||||||
PATHS_LOGS = "${cfg.dataDir}/log";
|
PATHS_LOGS = "${cfg.dataDir}/log";
|
||||||
|
|
||||||
SERVER_PROTOCOL = cfg.protocol;
|
SERVER_PROTOCOL = cfg.protocol;
|
||||||
|
@ -37,6 +38,8 @@ let
|
||||||
USERS_AUTO_ASSIGN_ORG_ROLE = cfg.users.autoAssignOrgRole;
|
USERS_AUTO_ASSIGN_ORG_ROLE = cfg.users.autoAssignOrgRole;
|
||||||
|
|
||||||
AUTH_ANONYMOUS_ENABLED = b2s cfg.auth.anonymous.enable;
|
AUTH_ANONYMOUS_ENABLED = b2s cfg.auth.anonymous.enable;
|
||||||
|
AUTH_ANONYMOUS_ORG_NAME = cfg.auth.anonymous.org_name;
|
||||||
|
AUTH_ANONYMOUS_ORG_ROLE = cfg.auth.anonymous.org_role;
|
||||||
|
|
||||||
ANALYTICS_REPORTING_ENABLED = b2s cfg.analytics.reporting.enable;
|
ANALYTICS_REPORTING_ENABLED = b2s cfg.analytics.reporting.enable;
|
||||||
} // cfg.extraOptions;
|
} // cfg.extraOptions;
|
||||||
|
@ -196,6 +199,17 @@ in {
|
||||||
default = false;
|
default = false;
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
};
|
};
|
||||||
|
org_name = mkOption {
|
||||||
|
description = "Which organization to allow anonymous access to";
|
||||||
|
default = "Main Org.";
|
||||||
|
type = types.str;
|
||||||
|
};
|
||||||
|
org_role = mkOption {
|
||||||
|
description = "Which role anonymous users have in the organization";
|
||||||
|
default = "Viewer";
|
||||||
|
type = types.str;
|
||||||
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
analytics.reporting = {
|
analytics.reporting = {
|
||||||
|
@ -222,6 +236,8 @@ in {
|
||||||
"Grafana passwords will be stored as plaintext in the Nix store!"
|
"Grafana passwords will be stored as plaintext in the Nix store!"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
environment.systemPackages = [ cfg.package ];
|
||||||
|
|
||||||
systemd.services.grafana = {
|
systemd.services.grafana = {
|
||||||
description = "Grafana Service Daemon";
|
description = "Grafana Service Daemon";
|
||||||
wantedBy = ["multi-user.target"];
|
wantedBy = ["multi-user.target"];
|
||||||
|
@ -234,6 +250,7 @@ in {
|
||||||
};
|
};
|
||||||
preStart = ''
|
preStart = ''
|
||||||
ln -fs ${cfg.package}/share/grafana/conf ${cfg.dataDir}
|
ln -fs ${cfg.package}/share/grafana/conf ${cfg.dataDir}
|
||||||
|
ln -fs ${cfg.package}/share/grafana/vendor ${cfg.dataDir}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{ lib, buildGoPackage, fetchurl, fetchFromGitHub }:
|
{ lib, buildGoPackage, fetchurl, fetchFromGitHub, phantomjs2 }:
|
||||||
|
|
||||||
buildGoPackage rec {
|
buildGoPackage rec {
|
||||||
version = "3.1.0";
|
version = "3.1.0";
|
||||||
|
@ -22,7 +22,8 @@ buildGoPackage rec {
|
||||||
postInstall = ''
|
postInstall = ''
|
||||||
tar -xvf $srcStatic
|
tar -xvf $srcStatic
|
||||||
mkdir -p $bin/share/grafana
|
mkdir -p $bin/share/grafana
|
||||||
mv grafana-*/{public,conf} $bin/share/grafana/
|
mv grafana-*/{public,conf,vendor} $bin/share/grafana/
|
||||||
|
ln -sf ${phantomjs2}/bin/phantomjs $bin/share/grafana/vendor/phantomjs/phantomjs
|
||||||
'';
|
'';
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
|
|
Loading…
Reference in a new issue