This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

superconfig / machines / icarus / config.nix
6.7 kB 221 lines
1{ config, lib, pkgs, ... }: 2 3{ 4 imports = [ 5 ../../2configs/mouse.nix 6 ../../2configs/retiolum.nix 7 ../../2configs/git.nix 8 ../../2configs/exim-retiolum.nix 9 ../../2configs/baseX.nix 10 ../../2configs/pipewire.nix 11 ../../2configs/browsers.nix 12 ../../2configs/programs.nix 13 ../../2configs/fetchWallpaper.nix 14 ../../2configs/games.nix 15 ../../2configs/bitcoin.nix 16 ../../2configs/wine.nix 17 ../../2configs/network-manager.nix 18 ../../2configs/red-host.nix 19 ../../2configs/ipfs.nix 20 ../../2configs/snapclient.nix 21 ../../2configs/consul.nix 22 { # === logging playground === 23 # --- client --- 24 25 # services.fluentd = { 26 # enable = true; 27 # config = '' 28 # ''; 29 # }; 30 31 # services.netdata = { 32 # enable = true; 33 # config = { 34 # global = { 35 # "debug log" = "syslog"; 36 # "error log" = "syslog"; 37 # }; 38 39 # backend = { 40 # enabled = "yes"; 41 # type = "opentsdb"; 42 # destination = "tcp:localhost:4242"; 43 # prefix = "netdata"; 44 # hostname = config.networking.hostName; 45 # }; 46 # # "exporting:global" = { 47 # # enabled = "yes"; 48 # # "update every" = "60"; 49 # # }; 50 # # "graphite:icarus" = { 51 # # enabled = "yes"; 52 # # destination = "localhost:8086"; 53 # # "data source" = "average"; 54 # # prefix = "netdata"; 55 # # hostname = config.networking.hostName; 56 # # "send charts matching" = "*"; 57 # # "send hosts matching" = "localhost *"; 58 # # "send names instead of ids" = "yes"; 59 # # }; 60 # }; 61 # }; 62 63 # - metrics 64 services.telegraf = { 65 enable = true; 66 extraConfig = { 67 inputs = { 68 cpu = {}; 69 mem = {}; 70 net = { 71 ignore_protocol_stats = true; 72 }; 73 exec = { 74 command = pkgs.writers.writePython3 "get_bat_stats" {} /* python */ '' 75 import json 76 import os 77 78 79 values_to_fetch = [ 80 "capacity", 81 "energy_now", 82 "energy_full", 83 "energy_full_design", 84 "charge_now", 85 "charge_full", 86 "charge_full_design", 87 ] 88 89 result = {} 90 for sup in os.listdir('/sys/class/power_supply'): 91 with open('/sys/class/power_supply/{}/type'.format(sup)) as f: 92 if f.read().strip() != "Battery": 93 continue 94 for val in values_to_fetch: 95 try: 96 with open('/sys/class/power_supply/{}/{}'.format(sup, val)) as f: 97 key = '{}_{}'.format(sup, val) 98 try: 99 result[key] = int(f.read().strip()) 100 except ValueError: 101 result[key] = f.read().strip() 102 except: # noqa 103 pass 104 105 print(json.dumps(result)) 106 ''; 107 data_format = "json"; 108 name_suffix = "_bat"; 109 interval = "10s"; 110 }; 111 }; 112 outputs = { 113 influxdb = { database = "telegraf"; urls = [ "http://localhost:8086" ]; }; 114 }; 115 }; 116 }; 117 118 # --- server --- 119 120 # - metrics 121 services.influxdb = { 122 enable = true; 123 extraConfig = { 124 opentsdb = [{ 125 enabled = true; 126 bind-address = ":4242"; 127 database = "opentsdb"; 128 retention-policy = ""; 129 130 batch-size = 1000; 131 batch-pending = 5; 132 batch-timeout = "1s"; 133 }]; 134 }; 135 }; 136 137 # - logs 138 services.graylog = { 139 enable = true; 140 passwordSecret = "AmjUYosI6hXKyI1MLEusupZy7srxQxZOowpHSmvF0ekMoi19go5qmnqd3po4VcQahdR1AKZ3Yk9tP6nLUbgmzLwQFodIc5g8"; 141 rootPasswordSha2 = "cf80cd8aed482d5d1527d7dc72fceff84e6326592848447d2dc0b0e87dfc9a90"; # testing 142 elasticsearchHosts = [ "http://localhost:9200" ]; 143 }; 144 145 services.elasticsearch = { 146 enable = true; 147 }; 148 # services.loki = { 149 # enable = true; 150 # configuration = { 151 # auth_enabled = false; 152 # server.http_listen_port = 3100; 153 # ingester = { 154 # lifecycler = { 155 # address = "127.0.0.1"; 156 # ring = { 157 # kvstore.store = "inmemory"; 158 # replication_factor = 1; 159 # }; 160 # final_sleep = "0s"; 161 # }; 162 # }; 163 # schema_config = { 164 # configs = [ 165 # { 166 # from = "2018-04-15"; 167 # store = "inmemory"; 168 # object_store = "filesystem"; 169 # schema = "v9"; 170 # } 171 # ]; 172 # }; 173 # storage_config = { 174 # filesystem.directory = "/tmp/loki/chunks"; 175 # }; 176 # #table_manager = { 177 # # chunk_tables_provisioning = { 178 # # inactive_read_throughput = 0; 179 # # inactive_write_throughput = 0; 180 # # provisioned_read_throughput = 0; 181 # # provisioned_write_throughput = 0; 182 # # }; 183 # # index_tables_provisioning = { 184 # # inactive_read_throughput = 0; 185 # # inactive_write_throughput = 0; 186 # # provisioned_read_throughput = 0; 187 # # provisioned_write_throughput = 0; 188 # # }; 189 # # retention_deletes_enabled = false; 190 # # retention_period = 0; 191 # #}; 192 # }; 193 # }; 194 195 services.grafana = { 196 enable = true; 197 addr = "0.0.0.0"; 198 auth.anonymous.enable = true; 199 auth.anonymous.org_role = "Admin"; 200 }; 201 krebs.iptables.tables.filter.INPUT.rules = [ 202 { predicate = "-p tcp --dport 3000"; target = "ACCEPT"; } # grafana 203 ]; 204 } 205 ]; 206 207 krebs.build.host = config.krebs.hosts.icarus; 208 209 # services.xrdp = { 210 # enable = true; 211 # defaultWindowManager = "xmonad"; 212 # }; 213 # krebs.iptables.tables.filter.INPUT.rules = [ 214 # { predicate = "-p tcp --dport 3389"; target = "ACCEPT"; } # xrdp 215 # ]; 216 217 environment.systemPackages = [ pkgs.chromium ]; 218 219 # users.users.lass.openssh.authorizedKeys = [ config.krebs.users.mic92.pubkey ]; 220 system.stateVersion = "22.05"; 221}