summaryrefslogtreecommitdiff
path: root/modules/development.nix
diff options
context:
space:
mode:
Diffstat (limited to 'modules/development.nix')
-rw-r--r--modules/development.nix152
1 files changed, 0 insertions, 152 deletions
diff --git a/modules/development.nix b/modules/development.nix
deleted file mode 100644
index 8520fc1..0000000
--- a/modules/development.nix
+++ /dev/null
@@ -1,152 +0,0 @@
-{ pkgs, lib, config, ... }: {
-
- options.development.enable = lib.mkOption {
- type = lib.types.bool;
- default = false;
- description = "enables development";
- };
-
- config = lib.mkIf config.development.enable {
-
- environment.systemPackages = with pkgs; [
-
- # Tools
- golangci-lint
- shellcheck
- beautysh # shell formatter
- rustup
- goose
- sqlc
- maven
- gradle
- kotlin
- gomodifytags
- go-tools # staticcheck
- gosec
- devtoolbox
- busybox # A bunch of utils like lsof and fuser
- libllvm
- universal-ctags
- valgrind
-
- prometheus
- grafana-loki
- grafana-alloy
- pyroscope
- ];
-
- # Grafana for eko
- services.grafana.enable = true;
- services.grafana.settings.server.http_port = 3030;
- services.grafana.settings.smtp.enabled = true;
- services.grafana.settings.smtp = {
- host = "smtp.example.com:587";
- user = "your@user.com";
- password = "super-secret"; # Consider using a file for secret
- skip_verify = true;
- from_address = "your@user.com";
- from_name = "Grafana";
- startTLS_policy = "OpportunisticStartTLS";
- };
-
- systemd.services.grafana = {
- serviceConfig = {
- ProtectHome = lib.mkForce false;
- ProtectSystem = lib.mkForce false;
- PrivateTmp = lib.mkForce false;
- ReadWritePaths = [ "/home/kyren/projects/eko" ];
- };
- };
-
- # # Allow grafana to access DB
- # fileSystems."/var/lib/grafana/eko" = {
- # device = "/home/kyren/projects/eko";
- # options = [ "bind" "ro" ];
- # };
-
- # Prometheus for eko
- services.prometheus.enable = true;
- services.prometheus.configText = builtins.readFile ./eko-prometheus.yml;
-
- # Alloy service for eko
- systemd.services.alloy = {
- description = "Alloy";
-
- wants = [ "network-online.target" ];
- after = [ "network-online.target" ];
- wantedBy = [ "multi-user.target" ];
-
- reloadTriggers = lib.mapAttrsToList (_: v: v.source or null) (
- lib.filterAttrs (n: _: lib.hasPrefix "alloy/" n && lib.hasSuffix ".alloy" n) config.environment.etc
- );
-
- serviceConfig = {
- Restart = "always";
- RestartSec = "2s";
-
- User = "root"; # TODO: make these not root?
- Group = "root";
-
- SupplementaryGroups = [
- # allow to read the systemd journal for loki log forwarding
- "systemd-journal"
- ];
-
- ConfigurationDirectory = "alloy";
- StateDirectory = "alloy";
- WorkingDirectory = "%S/alloy";
- Type = "simple";
-
- ExecStart = "${lib.getExe pkgs.grafana-alloy} run /etc/alloy/";
- ExecReload = "${pkgs.coreutils}/bin/kill -SIGHUP $MAINPID";
- };
- };
-
- environment.etc = {
- "alloy/eko-config.alloy".text = builtins.readFile ./eko-config.alloy;
- };
-
- # Loki service for eko
- services.loki.enable = true;
- services.loki.configuration = {
- auth_enabled = false;
-
- server = {
- http_listen_port = 3100;
- };
-
- common = {
- ring = {
- instance_addr = "127.0.0.1";
- kvstore = {
- store = "inmemory";
- };
- };
- replication_factor = 1;
- path_prefix = "/var/lib/loki";
- };
-
- schema_config = {
- configs = [
- {
- from = "2020-05-15";
- store = "tsdb";
- object_store = "filesystem";
- schema = "v13";
- index = {
- prefix = "index_";
- period = "24h";
- };
- }
- ];
- };
-
- storage_config = {
- filesystem = {
- directory = "/var/lib/loki/chunks";
- };
- };
- };
-
- };
-}