summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsinanmohd <sinan@sinanmohd.com>2024-06-03 20:50:58 +0530
committersinanmohd <sinan@sinanmohd.com>2024-06-03 21:25:00 +0530
commitd4f7650cd0735d1fe9173530cc31c24b65ed44ff (patch)
tree82086000936fed44120734ce2308207478d73954
parent279ff6251173e161cc50d8ae03cb3cd2e90a61a4 (diff)
global/font: init
-rw-r--r--flake.nix14
-rw-r--r--global/cez/default.nix6
-rw-r--r--global/common/default.nix6
-rw-r--r--global/common/modules/font.nix36
-rw-r--r--global/common/modules/userdata.nix (renamed from global/userdata.nix)0
-rw-r--r--global/default.nix5
-rw-r--r--home/cez/home.nix11
-rw-r--r--home/wayland/modules/foot.nix9
-rw-r--r--home/wayland/modules/sway/mako.nix8
-rw-r--r--home/wayland/modules/zathura.nix9
-rw-r--r--os/cez/modules/wayland.nix16
11 files changed, 87 insertions, 33 deletions
diff --git a/flake.nix b/flake.nix
index f6d8161..70153b4 100644
--- a/flake.nix
+++ b/flake.nix
@@ -26,18 +26,20 @@
nix.nixPath = [ "nixpkgs=${nixpkgs}" ];
}
- ./global
+ ./global/common
./os/${host}/configuration.nix
sops-nix.nixosModules.sops
- ];
+ ] ++ lib.optional (builtins.pathExists ./global/${host})
+ ./global/${host};
};
- makeHome = useType: system: home-manager.lib.homeManagerConfiguration {
+ makeHome = host: system: home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.${system};
modules = [
- ./global
- ./home/${useType}/home.nix
- ];
+ ./global/common
+ ./home/${host}/home.nix
+ ] ++ lib.optional (builtins.pathExists ./global/${host})
+ ./global/${host};
};
in
{
diff --git a/global/cez/default.nix b/global/cez/default.nix
new file mode 100644
index 0000000..f4fca99
--- /dev/null
+++ b/global/cez/default.nix
@@ -0,0 +1,6 @@
+{ ... }: {
+ global.font = {
+ sans.size = 13;
+ monospace.size = 18;
+ };
+}
diff --git a/global/common/default.nix b/global/common/default.nix
new file mode 100644
index 0000000..329963d
--- /dev/null
+++ b/global/common/default.nix
@@ -0,0 +1,6 @@
+{ ... }: {
+ imports = [
+ ./modules/font.nix
+ ./modules/userdata.nix
+ ];
+}
diff --git a/global/common/modules/font.nix b/global/common/modules/font.nix
new file mode 100644
index 0000000..cf0ea61
--- /dev/null
+++ b/global/common/modules/font.nix
@@ -0,0 +1,36 @@
+{ pkgs, lib, ... }: let
+ name = {
+ type = lib.types.str;
+ example = "Terminess Nerd Font";
+ };
+ size = {
+ type = with lib.types; nullOr int;
+ default = null;
+ };
+ packages = {
+ type = with lib.types; listOf path;
+ example = "[ pkgs.terminus-nerdfont ]";
+ };
+in {
+ options.global.font = {
+ sans = {
+ size = lib.mkOption size;
+ name = lib.mkOption (name // {
+ default = "DeepMind Sans";
+ });
+ packages = lib.mkOption (packages // {
+ default = [ pkgs.dm-sans ];
+ });
+ };
+
+ monospace = {
+ size = lib.mkOption size;
+ name = lib.mkOption (name // {
+ default = "Terminess Nerd Font";
+ });
+ packages = lib.mkOption (packages // {
+ default = [ pkgs.terminus-nerdfont ];
+ });
+ };
+ };
+}
diff --git a/global/userdata.nix b/global/common/modules/userdata.nix
index d591920..d591920 100644
--- a/global/userdata.nix
+++ b/global/common/modules/userdata.nix
diff --git a/global/default.nix b/global/default.nix
deleted file mode 100644
index 5bcb1ba..0000000
--- a/global/default.nix
+++ /dev/null
@@ -1,5 +0,0 @@
-{ ... }: {
- imports = [
- ./userdata.nix
- ];
-}
diff --git a/home/cez/home.nix b/home/cez/home.nix
index da3f6d6..a97ce83 100644
--- a/home/cez/home.nix
+++ b/home/cez/home.nix
@@ -1,12 +1,3 @@
-{ ... }: let
- font = "sans 13";
- monoFont = "monospace:size=18";
-in {
+{ ... }: {
imports = [ ../wayland/home.nix ];
-
- services.mako.font = font;
- programs = {
- zathura.options.font = font;
- foot.settings.main.font = monoFont;
- };
}
diff --git a/home/wayland/modules/foot.nix b/home/wayland/modules/foot.nix
index b068b87..77299aa 100644
--- a/home/wayland/modules/foot.nix
+++ b/home/wayland/modules/foot.nix
@@ -1,12 +1,17 @@
-{ lib, ... }: {
+{ config, lib, ... }: let
+ font = config.global.font.monospace.name
+ + ":size="
+ + lib.optionalString (config.global.font.monospace.size != null)
+ (builtins.toString config.global.font.monospace.size);
+in {
programs.foot = {
enable = true;
settings = {
colors.background = "000000";
main = {
+ inherit font;
pad = "10x10";
- font = lib.mkDefault "monospace";
};
};
};
diff --git a/home/wayland/modules/sway/mako.nix b/home/wayland/modules/sway/mako.nix
index 4280fdf..028ae66 100644
--- a/home/wayland/modules/sway/mako.nix
+++ b/home/wayland/modules/sway/mako.nix
@@ -1,8 +1,14 @@
-{ ... }: {
+{ config, lib, ... }: let
+ font = config.global.font.sans.name
+ + " "
+ + lib.optionalString (config.global.font.sans.size != null)
+ (builtins.toString config.global.font.sans.size);
+in {
services.mako = {
enable = true;
defaultTimeout = 3000;
+ inherit font;
borderSize = 2;
backgroundColor = "#000000";
};
diff --git a/home/wayland/modules/zathura.nix b/home/wayland/modules/zathura.nix
index 8437e80..9a013da 100644
--- a/home/wayland/modules/zathura.nix
+++ b/home/wayland/modules/zathura.nix
@@ -1,4 +1,9 @@
-{ lib, ... }: {
+{ config, lib, ... }: let
+ font = config.global.font.sans.name
+ + " "
+ + lib.optionalString (config.global.font.sans.size != null)
+ (builtins.toString config.global.font.sans.size);
+in {
programs.zathura = {
enable = true;
@@ -7,7 +12,7 @@
"[fullscreen] f" = "toggle_fullscreen";
};
options = {
- font = lib.mkDefault "Sans";
+ inherit font;
statusbar-basename = true;
selection-clipboard = "clipboard";
database = "sqlite";
diff --git a/os/cez/modules/wayland.nix b/os/cez/modules/wayland.nix
index b6499b7..338c585 100644
--- a/os/cez/modules/wayland.nix
+++ b/os/cez/modules/wayland.nix
@@ -1,5 +1,10 @@
{ config, pkgs, ... }: let
user = config.global.userdata.name;
+
+ fontSans = config.global.font.sans.name;
+ fontMonospace = config.global.font.monospace.name;
+ fontPackages = config.global.font.monospace.packages
+ ++ config.global.font.sans.packages;
in {
# pkgs
environment.systemPackages = with pkgs; [
@@ -35,18 +40,15 @@ in {
# font
fonts = {
- packages = with pkgs; [
- terminus-nerdfont
- dm-sans
- ];
+ packages = fontPackages;
enableDefaultPackages = true;
fontconfig = {
hinting.style = "full";
subpixel.rgba = "rgb";
defaultFonts = {
- monospace = [ "Terminess Nerd Font" ];
- serif = [ "DeepMind Sans" ];
- sansSerif = [ "DeepMind Sans" ];
+ monospace = [ fontMonospace ];
+ serif = [ fontSans ];
+ sansSerif = [ fontSans ];
};
};
};