anchor.diff:        description = "Grafana Service Daemon";
         wantedBy = ["multi-user.target"];
         after = ["networking.target"];
  +      environment = mapAttrs' (n: v: nameValuePair "GF_${n}" (toString v)) envOptions;
         serviceConfig = {
  -        ExecStart = "${cfg.package}/bin/grafana --config ${cfgFile} web";
  +        ExecStart = "${cfg.package}/bin/grafana -homepath ${cfg.dataDir}";
           WorkingDirectory = cfg.dataDir;
           User = "grafana";
         };
  +      preStart = ''
  +        ln -fs ${cfg.package}/share/grafana/conf ${cfg.dataDir}
  +      '';
       };
   
       users.extraUsers.grafana = {
  
positive.code:         type = types.bool;
        };
      };
    };
  
    config = mkIf cfg.enable {
  
negative.code: 
    b2s = val: if val then "true" else "false";
  
    envOptions = {
      PATHS_DATA = cfg.dataDir;
      PATHS_LOGS = "${cfg.dataDir}/log";
  
      SERVER_PROTOCOL = cfg.protocol;
      SERVER_HTTP_ADDR = cfg.addr;
      SERVER_HTTP_PORT = cfg.port;
      SERVER_DOMAIN = cfg.domain;
      SERVER_ROOT_URL = cfg.rootUrl;
      SERVER_STATIC_ROOT_PATH = cfg.staticRootPath;
      SERVER_CERT_FILE = cfg.certFile;
      SERVER_CERT_KEY = cfg.certKey;
  
      DATABASE_TYPE = cfg.database.type;
      DATABASE_HOST = cfg.database.host;
      DATABASE_NAME = cfg.database.name;
      DATABASE_USER = cfg.database.user;
      DATABASE_PASSWORD = cfg.database.password;
      DATABASE_PATH = cfg.database.path;
  
      SECURITY_ADMIN_USER = cfg.security.adminUser;
      SECURITY_ADMIN_PASSWORD = cfg.security.adminPassword;
      SECURITY_SECRET_KEY = cfg.security.secretKey;
  
      USERS_ALLOW_SIGN_UP = b2s cfg.users.allowSignUp;
      USERS_ALLOW_ORG_CREATE = b2s cfg.users.allowOrgCreate;
      USERS_AUTO_ASSIGN_ORG = b2s cfg.users.autoAssignOrg;
      USERS_AUTO_ASSIGN_ORG_ROLE = cfg.users.autoAssignOrgRole;
  
      AUTH_ANONYMOUS_ENABLE = b2s cfg.auth.anonymous.enable;
    } // cfg.extraOptions;
  
  in {
    options.services.grafana = {
  