about summary refs log tree commit diff
path: root/modules/nixos/common
diff options
context:
space:
mode:
Diffstat (limited to 'modules/nixos/common')
-rw-r--r--modules/nixos/common/console.nix10
-rw-r--r--modules/nixos/common/systemd.nix1
-rw-r--r--modules/nixos/common/xdg.nix104
3 files changed, 38 insertions, 77 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);
+        };
+      })
+    ];
+  };
 }

Consider giving Nix/NixOS a try! <3