From 2a7ec37178f22c83c1eb75485cd7ff91f16ac654 Mon Sep 17 00:00:00 2001 From: Azat Bahawi Date: Wed, 26 Oct 2022 00:51:41 +0300 Subject: 2022-10-26 --- flake.lock | 66 +++++++++++++++---------------- modules/nixfiles/android.nix | 18 +++++++++ modules/nixfiles/common/documentation.nix | 5 +-- modules/nixfiles/default.nix | 1 + modules/nixfiles/firefox/default.nix | 6 ++- modules/nixfiles/firefox/userContent.css | 25 ++++++++---- modules/nixfiles/grafana.nix | 58 +++++++++++++++++---------- modules/nixfiles/monitoring/default.nix | 10 ++--- 8 files changed, 117 insertions(+), 72 deletions(-) create mode 100644 modules/nixfiles/android.nix diff --git a/flake.lock b/flake.lock index bb5830d..9e4a3cf 100644 --- a/flake.lock +++ b/flake.lock @@ -377,11 +377,11 @@ ] }, "locked": { - "lastModified": 1666156198, - "narHash": "sha256-mTgPP4OIYerBpn9vVwcVdLn4GDjmlsZiqrVxHqZTiNo=", + "lastModified": 1666641778, + "narHash": "sha256-C5EHT/gi7FtEiPnKDUT2GK0/v46xXMIY8FgNsOHHCS0=", "owner": "nix-community", "repo": "emacs-overlay", - "rev": "858214991200eccc2f0a4f929f4baa0ffd8281c6", + "rev": "58d63216b84f9399db23048c537ee7c5d1842524", "type": "github" }, "original": { @@ -585,11 +585,11 @@ ] }, "locked": { - "lastModified": 1666080735, - "narHash": "sha256-4YWYJgzt9mGuAvXAuEziYms+bYlk/1spyt3iLizRL5I=", + "lastModified": 1666558342, + "narHash": "sha256-qiH0Zgig28yaSyebehrrYiX1y53Y/xFcQW+EFMRSVI0=", "owner": "nix-community", "repo": "home-manager", - "rev": "42f81ac107c5a9a177888080107094dba57f134e", + "rev": "186d9399f9eb64fb06ea4385732c1cf1624ae2b6", "type": "github" }, "original": { @@ -668,11 +668,11 @@ "ws-butler": "ws-butler" }, "locked": { - "lastModified": 1664622347, - "narHash": "sha256-pJTnEG68PhrXjpkfz/784BlcxaHgV06b1cUVGRxhMdw=", + "lastModified": 1666606461, + "narHash": "sha256-YNbI/dDtrzkSqJ2hi7UFbwmBRasHVE28n8IOgwhh4FA=", "owner": "nix-community", "repo": "nix-doom-emacs", - "rev": "b65e204ce9d20b376acc38ec205d08007eccdaef", + "rev": "4ae03d1dc2d8bf6daeda4f28be793ed2b82147bd", "type": "github" }, "original": { @@ -692,11 +692,11 @@ ] }, "locked": { - "lastModified": 1666162820, - "narHash": "sha256-qnpE2nOJNm8tCDVk4g+ihjQoxJ/8gLPmI219QZrCnUY=", + "lastModified": 1666577326, + "narHash": "sha256-wvHTJ+0UBEysXE+TiQOG6oaZEcwC9IQeBwW/8aGS7OE=", "owner": "jyooru", "repo": "nix-minecraft-servers", - "rev": "3fc8a413a5f2e506980ba475e64a443e30c8c852", + "rev": "12013698438fc2a68cc5b15a67b778b3a7c7d393", "type": "github" }, "original": { @@ -740,11 +740,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1666154393, - "narHash": "sha256-G4jctSMlliZvG4zUrcas0O+t3qJHzM0moBpG93lcl44=", + "lastModified": 1666603677, + "narHash": "sha256-apAEIj+z1iwMaMJ4tB21r/VTetfGDLDzuhXRHJknIAU=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "7b38cb118ce4ad36d19a8b021068633b57ce0d3f", + "rev": "074da18a72269cc5a6cf444dce42daea5649b2fe", "type": "github" }, "original": { @@ -756,11 +756,11 @@ }, "nixpkgs-master": { "locked": { - "lastModified": 1666168327, - "narHash": "sha256-nQjQtchYCUPi35BxKpYi0H6Bvoqoh+HZO30dIb31FzQ=", + "lastModified": 1666646783, + "narHash": "sha256-ywmovc9Fr3S0Ka+ljaKTkSN+8NXvblOG/UDkZbkD/cc=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "ef859e282251e878f3d71ca4917e213253ad6cbf", + "rev": "f6f42f3fcf4af3706461b902177b9caeb6aabfca", "type": "github" }, "original": { @@ -772,11 +772,11 @@ }, "nixpkgs-stable": { "locked": { - "lastModified": 1666164185, - "narHash": "sha256-5v+YB4ijeUfg5LCz9ck4gIpCPhIS+qn02OyPJO48bCE=", + "lastModified": 1666610816, + "narHash": "sha256-q4F2VNe5bpxXOvp16DyLwE1SgNZMbNO29ZQJPIomedg=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "c5203abb1329f7ea084c04acda330ca75d5b9fb5", + "rev": "6107f97012a0c134c5848125b5aa1b149b76d2c9", "type": "github" }, "original": { @@ -838,11 +838,11 @@ }, "nur": { "locked": { - "lastModified": 1666162734, - "narHash": "sha256-XFgV2TlQ7q2j1yjfgB/mayfORcKtmIAY2BGXTNRqNTs=", + "lastModified": 1666640642, + "narHash": "sha256-jMqV8vRro+F2Y6ge2caf3h6ZitKH/IiYLH3Wzd6rm6Q=", "owner": "nix-community", "repo": "NUR", - "rev": "15e8a12e8793e845708c17921f1985f486400c2b", + "rev": "17e3882babed0b965175b5c1f144bc3e052b8404", "type": "github" }, "original": { @@ -871,11 +871,11 @@ "org": { "flake": false, "locked": { - "lastModified": 1664493874, - "narHash": "sha256-8zLosjfQX0aR5HprtCeiSqN1pfB+GEUF9AULk6WRcR4=", + "lastModified": 1666258795, + "narHash": "sha256-k2FbWk4OJKZbih3pTvJYxkaXuauWsuaXXthV54UFqCM=", "owner": "emacs-straight", "repo": "org-mode", - "rev": "fe1f4f2ccf040deff9c57288d987f17cc2da321f", + "rev": "98cae03b7d9a612334d5ea461e73ac0b37b0285d", "type": "github" }, "original": { @@ -967,11 +967,11 @@ ] }, "locked": { - "lastModified": 1666160137, - "narHash": "sha256-8bQu+6poMzUyS2n3C1v3hkO6ZhRzj8Pf3CDCNckqQE4=", + "lastModified": 1666604592, + "narHash": "sha256-Bxy7xeVAwC0yxFaeYZM7N9Us/ebxpMC9TCceKEFeay4=", "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "e6c8efee1c108bb27522b9fd25b1cd0eb3288681", + "rev": "1b436f36e2812c589e6d830e3223059ea9661100", "type": "github" }, "original": { @@ -984,11 +984,11 @@ "revealjs": { "flake": false, "locked": { - "lastModified": 1664012352, - "narHash": "sha256-Pu5p6HqIO2wvWiTEhsQyIuwlWEIa1GjO3EDXosznyYE=", + "lastModified": 1665992801, + "narHash": "sha256-bqNgaBT6WPfumhdG1VPZ6ngn0QA9RDuVtVJtVwxbOd4=", "owner": "hakimel", "repo": "reveal.js", - "rev": "468132320d6e072abd1297d7cc24766a2b7a832d", + "rev": "f6f657b627f9703e32414d8d3f16fb49d41031cb", "type": "github" }, "original": { 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}"; -- cgit 1.4.1