about summary refs log tree commit diff
path: root/modules
diff options
context:
space:
mode:
authorAzat Bahawi <azat@bahawi.net>2022-10-26 00:51:41 +0300
committerAzat Bahawi <azat@bahawi.net>2022-10-26 00:51:41 +0300
commit2a7ec37178f22c83c1eb75485cd7ff91f16ac654 (patch)
treede928e73156f51f6983b002922822581c62fa077 /modules
parent2022-10-24 (diff)
2022-10-26
Diffstat (limited to 'modules')
-rw-r--r--modules/nixfiles/android.nix18
-rw-r--r--modules/nixfiles/common/documentation.nix5
-rw-r--r--modules/nixfiles/default.nix1
-rw-r--r--modules/nixfiles/firefox/default.nix6
-rw-r--r--modules/nixfiles/firefox/userContent.css25
-rw-r--r--modules/nixfiles/grafana.nix58
-rw-r--r--modules/nixfiles/monitoring/default.nix10
7 files changed, 84 insertions, 39 deletions
diff --git a/modules/nixfiles/android.nix b/modules/nixfiles/android.nix
new file mode 100644
index 0000000..307490a
--- /dev/null
+++ b/modules/nixfiles/android.nix
@@ -0,0 +1,18 @@
+{
+  config,
+  lib,
+  inputs,
+  pkgs,
+  ...
+}:
+with lib; let
+  cfg = config.nixfiles.modules.android;
+in {
+  options.nixfiles.modules.android.enable = mkEnableOption "support for Android devices";
+
+  config = mkIf cfg.enable {
+    programs.adb.enable = true;
+
+    my.extraGroups = ["adbusers"];
+  };
+}
diff --git a/modules/nixfiles/common/documentation.nix b/modules/nixfiles/common/documentation.nix
index 6e15aec..46ec9a5 100644
--- a/modules/nixfiles/common/documentation.nix
+++ b/modules/nixfiles/common/documentation.nix
@@ -11,10 +11,7 @@ with lib; {
       hm.manual = {
         html.enable = false;
         json.enable = false;
-        # FIXME Temporary workaround.
-        # https://github.com/nix-community/home-manager/issues/3342
-        # https://github.com/NixOS/nixpkgs/issues/196651
-        manpages.enable = false;
+        manpages.enable = true;
       };
 
       documentation = {
diff --git a/modules/nixfiles/default.nix b/modules/nixfiles/default.nix
index d59273e..82ccc27 100644
--- a/modules/nixfiles/default.nix
+++ b/modules/nixfiles/default.nix
@@ -3,6 +3,7 @@
     ./acme.nix
     ./alacritty.nix
     ./alertmanager.nix
+    ./android.nix
     ./aria2.nix
     ./bat.nix
     ./beets.nix
diff --git a/modules/nixfiles/firefox/default.nix b/modules/nixfiles/firefox/default.nix
index 3380eb3..8642b6f 100644
--- a/modules/nixfiles/firefox/default.nix
+++ b/modules/nixfiles/firefox/default.nix
@@ -248,7 +248,7 @@ in {
             "full-screen-api.warning.delay" = 0;
             "full-screen-api.warning.timeout" = 0;
             "general.autoScroll" = true;
-            "general.smoothScroll" = false;
+            "general.smoothScroll" = true;
             "identity.fxaccounts.enabled" = false;
             "media.autoplay.blocking_policy" = 2;
             "media.autoplay.default" = 5;
@@ -263,9 +263,11 @@ in {
         with config.nixfiles.modules;
           [
             bitwarden
+            consent-o-matic
             darkreader
-            libredirect
+            localcdn
             noscript
+            privacy-redirect
             ublock-origin
             violentmonkey
           ]
diff --git a/modules/nixfiles/firefox/userContent.css b/modules/nixfiles/firefox/userContent.css
index 815514f..1440c1a 100644
--- a/modules/nixfiles/firefox/userContent.css
+++ b/modules/nixfiles/firefox/userContent.css
@@ -26,11 +26,11 @@
 @-moz-document regexp("https?:\/\/(.*\.)?github.com.*") {
     #org-repo-pin-select-menu,
     #sponsor-button,
+    .btn.ml-2.d-none.d-md-block, /* Go to file button */
     .dropdown-divider,
     .footer,
     .octicon.octicon-info,
     .pt-3.mt-3.d-none.d-md-block, /* Profile achievements. */
-    .details-overlay.details-reset.position-relative.d-block, /* Add file button. */
     .starring-container,
     .user-profile-link,
     .user-status-circle-badge-container,
@@ -129,7 +129,7 @@
     }
 }
 
-@-moz-document regexp("https:\/\/habr\.com\/(ru|en)\/(article|company\/.*\/blog|post)\/.*") {
+@-moz-document regexp("https?:\/\/habr\.com\/(ru|en)\/(article|company\/.*\/blog|post)\/.*") {
     .Vue-Toastification__container,
     .tm-article-presenter__footer,
     .tm-article-presenter__meta,
@@ -207,7 +207,7 @@
     }
 }
 
-@-moz-document regexp("https:\/\/\.*\.hh\.ru.*") {
+@-moz-document regexp("https?:\/\/\.*\.hh\.ru.*") {
     .HH-Supernova-Footer,
     .index-dashboard-applicant__banners,
     .notification-manager,
@@ -245,13 +245,22 @@
     }
 }
 
-@-moz-document regexp("https:\/\/\.*\.wiki(pedia|less)\.org.*") {
+@-moz-document regexp("https?:\/\/(.*\.)?wikipedia\.org\/wiki\/.*") {
     #footer,
     #mp-topbanner,
-    #mw-head,
-    #mw-page-base,
-    #siteNotice,
-    .wbc-editpage {
+    #siteNotice {
         display: none !important;
     }
 }
+
+@-moz-document regexp("https?:\/\/wikiless\.org\/wiki\/.*") {
+    #footer,
+    #mw-navigation,
+    #mw-page-base {
+        display: none !important;
+    }
+
+    .mw-body {
+        margin-left: auto !important;
+    }
+}
diff --git a/modules/nixfiles/grafana.nix b/modules/nixfiles/grafana.nix
index 807f8fe..b98be13 100644
--- a/modules/nixfiles/grafana.nix
+++ b/modules/nixfiles/grafana.nix
@@ -28,13 +28,18 @@ in {
   in
     mkIf cfg.enable {
       secrets = {
+        grafana-key = {
+          file = "${inputs.self}/secrets/grafana-key";
+          owner = "grafana";
+          group = "grafana";
+        };
         grafana-admin-password = {
           file = "${inputs.self}/secrets/grafana-admin-password";
           owner = "grafana";
           group = "grafana";
         };
-        grafana-key = {
-          file = "${inputs.self}/secrets/grafana-key";
+        grafana-smtp-password = {
+          file = "${inputs.self}/secrets/grafana-smtp-password";
           owner = "grafana";
           group = "grafana";
         };
@@ -64,25 +69,38 @@ in {
         grafana = {
           enable = true;
 
-          inherit (cfg) domain port;
-          protocol = "http";
-          addr = "127.0.0.1";
-
-          analytics.reporting.enable = false;
-
-          database = {
-            type = "postgres";
-            host = "/run/postgresql";
-            name = db;
-            user = db;
-          };
-
-          security = with config.secrets; {
-            secretKeyFile = grafana-key.path;
-            adminPasswordFile = grafana-admin-password.path;
+          settings = {
+            server = with cfg; {
+              protocol = "http";
+              http_addr = "127.0.0.1";
+              http_port = port;
+              inherit domain;
+              enable_gzip = true;
+            };
+            database = {
+              type = "postgres";
+              host = "/run/postgresql";
+              name = db;
+              user = db;
+            };
+            smtp = {
+              enable = true;
+              user = "azahi@shire.me";
+              host = my.domain.shire;
+              password = "$__file{${config.secrets.grafana-smtp-password.path}}";
+            };
+            user = {
+              allow_org_create = false;
+              allow_sign_up = false;
+              auto_assign_org = false;
+              auto_assign_org_role = "Viewer";
+            };
+            security = with config.secrets; {
+              secret_key = grafana-key.path;
+              admin_password = grafana-admin-password.path;
+            };
+            analytics.reporting_enable = false;
           };
-
-          extraOptions.LOG_LEVEL = "warn";
         };
 
         postgresql = {
diff --git a/modules/nixfiles/monitoring/default.nix b/modules/nixfiles/monitoring/default.nix
index d5ed1b5..4ff4c50 100644
--- a/modules/nixfiles/monitoring/default.nix
+++ b/modules/nixfiles/monitoring/default.nix
@@ -23,7 +23,8 @@ in {
       grafana.provision = {
         enable = true;
 
-        datasources = with config.nixfiles.modules; [
+        # https://grafana.com/docs/grafana/latest/administration/provisioning/#data-sources
+        datasources.settings.datasources = with config.nixfiles.modules; [
           {
             name = "Prometheus";
             type = "prometheus";
@@ -39,12 +40,13 @@ in {
           }
         ];
 
-        dashboards = [
+        # https://grafana.com/docs/grafana/latest/administration/provisioning/#dashboards
+        dashboards.settings.providers = [
           # System dashboard is imported manually from here[1]. Too bad
           # provisioned dashboards cannot properly integrate dynamic datasources
           # yet.
           #
-          # [1]: https://grafana.com/grafana/dashboards/1860-node-exporter-full/
+          # [1]: https://grafana.com/grafana/dashboards/1860-node-exporter-full
           {
             name = "endlessh";
             options.path = ./dashboards/endlessh.json;
@@ -62,8 +64,6 @@ in {
             options.path = ./dashboards/postgresql.json;
           }
         ];
-
-        notifiers = []; # TODO Add.
       };
 
       loki.configuration.ruler.alertmanager_url = "https://${config.nixfiles.modules.alertmanager.domain}";

Consider giving Nix/NixOS a try! <3