about summary refs log tree commit diff
path: root/modules/nixos
diff options
context:
space:
mode:
Diffstat (limited to 'modules/nixos')
-rw-r--r--modules/nixos/common/console.nix10
-rw-r--r--modules/nixos/common/systemd.nix1
-rw-r--r--modules/nixos/common/xdg.nix104
-rw-r--r--modules/nixos/default.nix1
-rw-r--r--modules/nixos/emacs.nix15
-rw-r--r--modules/nixos/firefox/default.nix6
-rw-r--r--modules/nixos/firefox/userContent.css1
-rw-r--r--modules/nixos/kde.nix2
-rw-r--r--modules/nixos/profiles/headful.nix40
-rw-r--r--modules/nixos/thunderbird.nix53
-rw-r--r--modules/nixos/unbound.nix4
11 files changed, 118 insertions, 119 deletions
diff --git a/modules/nixos/common/console.nix b/modules/nixos/common/console.nix
index 3c73695..60a7153 100644
--- a/modules/nixos/common/console.nix
+++ b/modules/nixos/common/console.nix
@@ -1,6 +1,14 @@
-{config, ...}: {
+{
+  config,
+  lib,
+  pkgs,
+  ...
+}:
+with lib; {
   console = {
     earlySetup = true;
+    colors = take 16 (mapAttrsToList (_: removePrefix "#") config.colourScheme);
+    font = "${pkgs.terminus_font}/share/consolefonts/ter-v16b.psf.gz";
     useXkbConfig = config.services.xserver.enable;
   };
 }
diff --git a/modules/nixos/common/systemd.nix b/modules/nixos/common/systemd.nix
index 4e9eb26..f3d5217 100644
--- a/modules/nixos/common/systemd.nix
+++ b/modules/nixos/common/systemd.nix
@@ -23,6 +23,7 @@
   };
 
   environment.sessionVariables = {
+    SYSTEMD_PAGERSECURE = "1";
     SYSTEMD_PAGER = "${pkgs.less}/bin/less";
     SYSTEMD_LESS = "FRSXMK";
   };
diff --git a/modules/nixos/common/xdg.nix b/modules/nixos/common/xdg.nix
index b46c350..668996f 100644
--- a/modules/nixos/common/xdg.nix
+++ b/modules/nixos/common/xdg.nix
@@ -7,85 +7,37 @@
 with lib; let
   cfg = config.nixfiles.modules.common.xdg;
 in {
-  xdg.portal = mkIf this.isHeadful {
-    enable = true;
+  options.nixfiles.modules.common.xdg.defaultApplications = mkOption {
+    description = "Default applications.";
+    type = with types; attrsOf (listOf str);
+    default = {};
   };
 
-  hm.xdg = mkMerge [
-    (with cfg; {
+  config = {
+    xdg.portal = mkIf this.isHeadful {
       enable = true;
+    };
 
-      inherit cacheHome;
-      inherit configHome;
-      inherit dataHome;
-      inherit stateHome;
-      inherit userDirs;
-    })
-    (mkIf this.isHeadful {
-      mimeApps = {
+    hm.xdg = mkMerge [
+      (with cfg; {
         enable = true;
-        # https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types
-        defaultApplications = mkMerge (mapAttrsToList
-          (n: v: genAttrs v (_: ["${n}.desktop"]))
-          {
-            emacsclient = [
-              "application/json"
-              "application/ld+json"
-              "application/vnd.ms-publisher"
-              "application/x-c"
-              "application/x-desktop"
-              "application/x-httpd-php"
-              "application/x-sh"
-              "application/x-tex"
-              "application/xhtml+xml"
-              "application/xml"
-              "text/css"
-              "text/csv"
-              "text/javascript"
-              "text/markdown"
-              "text/plain"
-              "text/x-lisp"
-            ];
-            firefox = [
-              "text/html"
-              "x-scheme-handler/http"
-              "x-scheme-handler/https"
-            ];
-            mpv = [
-              "audio/3gpp"
-              "audio/3gpp2"
-              "audio/aac"
-              "audio/flac"
-              "audio/mp3"
-              "audio/mpeg"
-              "audio/ogg"
-              "audio/opus"
-              "audio/wav"
-              "audio/webm"
-              "image/avif"
-              "image/bmp"
-              "image/gif"
-              "image/jpeg"
-              "image/jpg"
-              "image/png"
-              "image/tiff"
-              "image/vnd.microsoft.icon"
-              "image/webp"
-              "video/mkv"
-              "video/mp2t"
-              "video/mp4"
-              "video/mpeg"
-              "video/ogg"
-              "video/webm"
-              "video/x-matroska"
-              "video/x-msvideo"
-            ];
-            "org.pwmt.zathura" = [
-              "application/pdf"
-              "application/epub+zip"
-            ];
-          });
-      };
-    })
-  ];
+
+        inherit cacheHome;
+        inherit configHome;
+        inherit dataHome;
+        inherit stateHome;
+        inherit userDirs;
+      })
+      (mkIf this.isHeadful {
+        mimeApps = {
+          enable = true;
+          defaultApplications =
+            mkMerge
+            (mapAttrsToList
+              (n: v: genAttrs v (_: ["${n}.desktop"]))
+              cfg.defaultApplications);
+        };
+      })
+    ];
+  };
 }
diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix
index e8c9467..1b1ec75 100644
--- a/modules/nixos/default.nix
+++ b/modules/nixos/default.nix
@@ -61,6 +61,7 @@ _: {
     ./sound.nix
     ./syncthing.nix
     ./throttled.nix
+    ./thunderbird.nix
     ./unbound.nix
     ./vaultwarden.nix
     ./vim
diff --git a/modules/nixos/emacs.nix b/modules/nixos/emacs.nix
index 5e263c9..8163c45 100644
--- a/modules/nixos/emacs.nix
+++ b/modules/nixos/emacs.nix
@@ -7,7 +7,20 @@ with lib; let
   cfg = config.nixfiles.modules.emacs;
 in {
   config = mkIf cfg.enable {
-    nixfiles.modules.x11.enable = true;
+    nixfiles.modules = {
+      common.xdg.defaultApplications.emacsclient = [
+        "application/atom+xml"
+        "application/json"
+        "application/rss+xml"
+        "application/schema+json"
+        "application/xhtml+xml"
+        "application/xml"
+        "text/csv"
+        "text/plain"
+      ];
+
+      x11.enable = true;
+    };
 
     hm.services.emacs = {
       enable = true;
diff --git a/modules/nixos/firefox/default.nix b/modules/nixos/firefox/default.nix
index e725e95..041752d 100644
--- a/modules/nixos/firefox/default.nix
+++ b/modules/nixos/firefox/default.nix
@@ -11,6 +11,12 @@ in {
   options.nixfiles.modules.firefox.enable = mkEnableOption "Firefox";
 
   config = mkIf cfg.enable {
+    nixfiles.modules.common.xdg.defaultApplications.firefox = [
+      "text/html"
+      "x-scheme-handler/http"
+      "x-scheme-handler/https"
+    ];
+
     hm = {
       imports = [inputs.arkenfox-nixos.hmModules.arkenfox];
 
diff --git a/modules/nixos/firefox/userContent.css b/modules/nixos/firefox/userContent.css
index f5497ab..bb80dbc 100644
--- a/modules/nixos/firefox/userContent.css
+++ b/modules/nixos/firefox/userContent.css
@@ -316,6 +316,7 @@
     #mp-topbanner,
     #siteNotice,
     #siteSub,
+    #wmde-banner-app,
     .mw-footer-container,
     .mw-header,
     .vector-page-toolbar {
diff --git a/modules/nixos/kde.nix b/modules/nixos/kde.nix
index 17fcf03..1a02d9d 100644
--- a/modules/nixos/kde.nix
+++ b/modules/nixos/kde.nix
@@ -11,6 +11,8 @@ in {
 
   config = mkIf cfg.enable {
     nixfiles.modules = {
+      common.xdg.defaultApplications."org.kde.dolphin" = ["inode/directory"];
+
       gnupg.pinentry = "qt";
       sound.enable = true;
       x11.enable = true;
diff --git a/modules/nixos/profiles/headful.nix b/modules/nixos/profiles/headful.nix
index 6658582..938b711 100644
--- a/modules/nixos/profiles/headful.nix
+++ b/modules/nixos/profiles/headful.nix
@@ -12,6 +12,7 @@ in {
       chromium.enable = true;
       firefox.enable = true;
       sound.enable = true;
+      thunderbird.enable = true;
 
       nullmailer.enable = true;
 
@@ -30,43 +31,7 @@ in {
         tor-browser-bundle-bin
       ];
 
-      programs = {
-        bash.shellAliases.open = "xdg-open";
-
-        thunderbird = {
-          enable = true;
-          profiles.default = {
-            isDefault = true;
-            withExternalGnupg = true;
-          };
-          settings = {
-            "app.update.auto" = false;
-            "browser.display.document_color_use" = 2;
-            "browser.display.use_system_colors" = true;
-            "browser.search.region" = "US";
-            "browser.search.update" = false;
-            "datareporting.healthreport.uploadEnabled" = false;
-            "full-screen-api.warning.delay" = 0;
-            "full-screen-api.warning.timeout" = 0;
-            "general.autoScroll" = true;
-            "general.smoothScroll" = true;
-            "mail.default_send_format" = 0;
-            "mail.tabs.drawInTitlebar" =
-              if config.nixfiles.modules.kde.enable
-              then 1
-              else 0;
-            "mailnews.start_page.url" = "about:blank";
-            "media.autoplay.blocking_policy" = 2;
-            "media.autoplay.default" = 5;
-            "media.autoplay.enabled" = false;
-            "media.hardwaremediakeys.enabled" = false;
-            "network.cookie.cookieBehavior" = 2;
-            "places.history.enabled" = false;
-            "reader.parse-on-load.enabled" = false;
-            "toolkit.legacyUserProfileCustomizations.stylesheets" = true;
-          };
-        };
-      };
+      programs.bash.shellAliases.open = "xdg-open";
     };
 
     boot = {
@@ -104,7 +69,6 @@ in {
     };
 
     services = {
-      # https://github.com/NixOS/nixpkgs/issues/135888
       upower.enable = true;
 
       psd.enable = true;
diff --git a/modules/nixos/thunderbird.nix b/modules/nixos/thunderbird.nix
new file mode 100644
index 0000000..5afb163
--- /dev/null
+++ b/modules/nixos/thunderbird.nix
@@ -0,0 +1,53 @@
+{
+  config,
+  lib,
+  ...
+}:
+with lib; let
+  cfg = config.nixfiles.modules.thunderbird;
+in {
+  options.nixfiles.modules.thunderbird.enable = mkEnableOption "Thunderbird";
+
+  config = mkIf cfg.enable {
+    nixfiles.modules.common.xdg.defaultApplications.thunderbird = [
+      "message/rfc822"
+      "x-scheme-handler/mailto"
+    ];
+
+    hm = {
+      programs.thunderbird = {
+        enable = true;
+        profiles.default = {
+          isDefault = true;
+          withExternalGnupg = true;
+        };
+        settings = {
+          "app.update.auto" = false;
+          "browser.display.document_color_use" = 2;
+          "browser.display.use_system_colors" = true;
+          "browser.search.region" = "US";
+          "browser.search.update" = false;
+          "datareporting.healthreport.uploadEnabled" = false;
+          "full-screen-api.warning.delay" = 0;
+          "full-screen-api.warning.timeout" = 0;
+          "general.autoScroll" = true;
+          "general.smoothScroll" = true;
+          "mail.default_send_format" = 0;
+          "mail.tabs.drawInTitlebar" =
+            if config.nixfiles.modules.kde.enable
+            then 1
+            else 0;
+          "mailnews.start_page.url" = "about:blank";
+          "media.autoplay.blocking_policy" = 2;
+          "media.autoplay.default" = 5;
+          "media.autoplay.enabled" = false;
+          "media.hardwaremediakeys.enabled" = false;
+          "network.cookie.cookieBehavior" = 2;
+          "places.history.enabled" = false;
+          "reader.parse-on-load.enabled" = false;
+          "toolkit.legacyUserProfileCustomizations.stylesheets" = true;
+        };
+      };
+    };
+  };
+}
diff --git a/modules/nixos/unbound.nix b/modules/nixos/unbound.nix
index 4d21fd2..dd7e757 100644
--- a/modules/nixos/unbound.nix
+++ b/modules/nixos/unbound.nix
@@ -151,14 +151,12 @@ in {
           localControlSocketPath = "/run/unbound/unbound.socket";
         };
 
-        # TODO Switch to https://github.com/letsencrypt/unbound_exporter.
         prometheus.exporters.unbound = {
           enable = true;
           listenAddress = mkDefault this.wireguard.ipv4.address;
           port = 9167;
-          fetchType = "uds";
-          controlInterface = config.services.unbound.localControlSocketPath;
           inherit (config.services.unbound) group user;
+          unbound.host = "unix://${config.services.unbound.localControlSocketPath}";
         };
       };
 

Consider giving Nix/NixOS a try! <3