Skip to content

Commit

Permalink
monitoring: improvments to redeplyablity
Browse files Browse the repository at this point in the history
Co-authored-by: NotAShelf <[email protected]>
  • Loading branch information
isabelroses and NotAShelf committed Nov 8, 2023
1 parent 5ab3586 commit 2877494
Show file tree
Hide file tree
Showing 14 changed files with 599 additions and 44 deletions.
81 changes: 79 additions & 2 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,16 @@
inputs.nixpkgs-stable.follows = "nixpkgs";
};

# More up to date minecraft launcher
prism-launcher = {
url = "github:PrismLauncher/PrismLauncher";
inputs = {
nixpkgs.follows = "nixpkgs";
flake-parts.follows = "flake-parts";
pre-commit-hooks.follows = "pre-commit-hooks";
};
};

# Hyprland packages
hyprland.url = "github:hyprwm/Hyprland";

Expand Down
6 changes: 5 additions & 1 deletion home/isabel/programs/gui/gaming/minecraft/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
lib,
pkgs,
osConfig,
inputs',
...
}: let
catppuccin-mocha = pkgs.fetchzip {
Expand Down Expand Up @@ -32,8 +33,11 @@ in {
};

packages = [
(pkgs.prismlauncher.override {
(inputs'.prism-launcher.packages.prismlauncher.override {
# get java versions required by various minecraft versions
# "write once run everywhere" my ass
jdks = javaPackages;
additionalPrograms = with pkgs; [gamemode mangohud];
})
];
};
Expand Down
1 change: 1 addition & 0 deletions hosts/bernie/services.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ _: {
monitoring = {
grafana.enable = true;
prometheus.enable = true;
loki.enable = true;
};

database = {
Expand Down
7 changes: 5 additions & 2 deletions modules/base/common/host/os/network/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ in {

users = {
groups.tcpcryptd = {};
users.tcpcryptd.group = "tcpcryptd";
users.tcpcryptd = {
isSystemUser = true;
group = "tcpcryptd";
};
};

services = {
Expand All @@ -42,7 +45,7 @@ in {
# enable opportunistic TCP encryption
# this is NOT a pancea, however, if the receiver supports encryption and the attacker is passive
# privacy will be more plausible (but not guaranteed, unlike what the option docs suggest)
tcpcrypt.enable = true;
tcpcrypt.enable = false;

# dns
nameservers = [
Expand Down
21 changes: 12 additions & 9 deletions modules/base/common/services/matrix/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
bindAddress = "::1";
serverConfig."m.server" = "${config.services.matrix-synapse.settings.server_name}:443";
clientConfig = {
"m.homeserver".base_url = "https://${config.networking.hostName}${domain}";
"m.homeserver".base_url = "https://${domain}";
"m.identity_server" = {};
};

Expand Down Expand Up @@ -46,14 +46,17 @@ in {
};

nginx.virtualHosts = {
${domain} = {
locations = {
"= /.well-known/matrix/server".extraConfig = mkWellKnown serverConfig;
"= /.well-known/matrix/client".extraConfig = mkWellKnown clientConfig;
"/_matrix".proxyPass = "http://[${bindAddress}]:${toString port}";
"/_synapse/client".proxyPass = "http://[${bindAddress}]:${toString port}";
};
};
${domain} =
{
locations = {
"= /.well-known/matrix/server".extraConfig = mkWellKnown serverConfig;
"= /.well-known/matrix/client".extraConfig = mkWellKnown clientConfig;
"/_matrix".proxyPass = "http://[${bindAddress}]:${toString port}";
"/_synapse/client".proxyPass = "http://[${bindAddress}]:${toString port}";
};
}
// sslTemplate;

"matrix.${domain}" =
{
locations."/".proxyPass = "http://127.0.0.1:8008";
Expand Down
1 change: 1 addition & 0 deletions modules/base/common/services/monitoring/default.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
_: {
imports = [
./grafana
./loki
./prometheus
];
}
26 changes: 26 additions & 0 deletions modules/base/common/services/monitoring/grafana/dashboards.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
lib,
pkgs,
...
}: let
loadDashboard = file:
lib.pipe file [
lib.importJSON
({dashboard, ...}: rec {
name = "provision-dashboard-${dashboard.uid}.json";
path = builtins.toFile name (builtins.toJSON dashboard);
})
];

dashboardsDir =
pkgs.linkFarm
"grafana-provisioning-dashboards"
(map loadDashboard (lib.filesystem.listFilesRecursive ./dashboards));
in {
services.grafana.provision.dashboards.settings = {
providers = lib.singleton {
options.path = dashboardsDir;
allowUiUpdates = true;
};
};
}
Loading

0 comments on commit 2877494

Please sign in to comment.