about summary refs log tree commit diff
path: root/modules/common/stylix.nix
diff options
context:
space:
mode:
authorAzat Bahawi <azat@bahawi.net>2024-04-21 02:15:42 +0300
committerAzat Bahawi <azat@bahawi.net>2024-04-21 02:15:42 +0300
commite6ed60548397627bf10f561f9438201dbba0a36e (patch)
treef9a84c5957d2cc4fcd148065ee9365a0c851ae1c /modules/common/stylix.nix
parent2024-04-18 (diff)
2024-04-21
Diffstat (limited to '')
-rw-r--r--modules/common/stylix.nix105
1 files changed, 105 insertions, 0 deletions
diff --git a/modules/common/stylix.nix b/modules/common/stylix.nix
new file mode 100644
index 0000000..953685e
--- /dev/null
+++ b/modules/common/stylix.nix
@@ -0,0 +1,105 @@
+{
+  config,
+  inputs,
+  lib,
+  pkgs,
+  ...
+}:
+with lib;
+{
+  imports = [
+    inputs.stylix.nixosModules.stylix
+    (mkAliasOptionModule [ "colors" ] [
+      "lib"
+      "stylix"
+      "colors"
+    ])
+  ];
+
+  options.nixfiles.modules.common.stylix.fonts.extraPackages = mkOption {
+    description = "Font packages.";
+    default = with pkgs; [
+      font-awesome
+      noto-fonts
+      noto-fonts-emoji
+      sarasa-gothic
+      source-han-mono
+      source-han-sans
+      source-han-serif
+      twitter-color-emoji
+    ];
+    readOnly = true;
+  };
+
+  # Styling and color binding can be sourced from here[1].
+  #
+  # [1]: https://github.com/tinted-theming/base24/blob/master/styling.md
+  config = {
+    stylix = {
+      image = pkgs.fetchurl {
+        url = "https://upload.wikimedia.org/wikipedia/commons/a/a5/Bonaparte_ante_la_Esfinge%2C_por_Jean-Léon_Gérôme.jpg";
+        sha256 = "sha256-qWv52oT8cF9K4ZoeawmR3jgoGB2ARfjbKKc12IljUcM=";
+      };
+
+      base16Scheme = "${pkgs.base16-schemes}/share/themes/tomorrow.yaml";
+
+      fonts = {
+        monospace = {
+          package = pkgs.iosevka;
+          name = "Iosevka";
+        };
+
+        serif = {
+          package = pkgs.iosevka-bin.override { variant = "Etoile"; };
+          name = "Iosevka Etoile";
+        };
+
+        sansSerif = {
+          package = pkgs.iosevka-bin.override { variant = "Aile"; };
+          name = "Iosevka Aile";
+        };
+
+        sizes = {
+          desktop = 10;
+          applications = 10;
+          terminal = 12;
+        };
+      };
+
+      cursor = {
+        name = "phinger-cursors-light";
+        package = pkgs.phinger-cursors;
+        size = 32;
+      };
+    };
+
+    fonts = {
+      packages = mkAfter config.nixfiles.modules.common.stylix.fonts.extraPackages;
+
+      fontconfig.defaultFonts = with config.stylix.fonts; {
+        serif = mkForce [
+          serif.name
+          "Sarasa Gothic"
+          "Source Han Serif"
+          "Noto Serif"
+        ];
+        sansSerif = mkForce [
+          sansSerif.name
+          "Sarasa Gothic"
+          "Source Han Sans"
+          "Noto Sans"
+        ];
+        monospace = mkForce [
+          monospace.name
+          "Sarasa Mono"
+          "Source Han Mono"
+          "Noto Sans Mono"
+        ];
+        emoji = mkForce [
+          "Twitter Color Emoji"
+          "Noto Color Emoji"
+        ];
+      };
+    };
+  };
+}

Consider giving Nix/NixOS a try! <3