From eafb6ddbb78268a197268bbaf2db0a2032cca181 Mon Sep 17 00:00:00 2001 From: Felix Buehler Date: Tue, 4 Apr 2023 00:12:19 +0200 Subject: [PATCH] system/fonts: init from legacy --- legacy/modules/desktop-default.nix | 4 --- legacy/modules/fonts.nix | 28 ------------------- machines/thinkman/system.nix | 1 + modules/system/default.nix | 1 + modules/system/fonts/default.nix | 44 ++++++++++++++++++++++++++++++ 5 files changed, 46 insertions(+), 32 deletions(-) delete mode 100644 legacy/modules/fonts.nix create mode 100644 modules/system/fonts/default.nix diff --git a/legacy/modules/desktop-default.nix b/legacy/modules/desktop-default.nix index b0813db..2199fd2 100644 --- a/legacy/modules/desktop-default.nix +++ b/legacy/modules/desktop-default.nix @@ -1,9 +1,5 @@ { config, lib, pkgs, ... }: { - imports = [ - ./fonts.nix - ]; - programs.gnome-disks.enable = true; services.udisks2.enable = true; diff --git a/legacy/modules/fonts.nix b/legacy/modules/fonts.nix deleted file mode 100644 index 98be8ab..0000000 --- a/legacy/modules/fonts.nix +++ /dev/null @@ -1,28 +0,0 @@ -{ config, pkgs, ... }: -{ - fonts = { - fontconfig.defaultFonts = { - sansSerif = [ "Ubuntu" ]; - monospace = [ "Ubuntu Mono" ]; - }; - - fonts = with pkgs; [ - cantarell-fonts # gnome default - fira - fira-code # coding - fira-code-symbols # ligatures - fira-mono - font-awesome # icons - joypixels # emojis - liberation_ttf # main microsoft fonts - # mplus-outline-fonts.githubRelease # microsoft fonts - noto-fonts - noto-fonts-cjk-sans - noto-fonts-emoji - noto-fonts-extra - ubuntu_font_family - unifont # unicode fallback - ]; - }; - nixpkgs.config.joypixels.acceptLicense = true; -} diff --git a/machines/thinkman/system.nix b/machines/thinkman/system.nix index cf0b0a2..517df06 100644 --- a/machines/thinkman/system.nix +++ b/machines/thinkman/system.nix @@ -6,6 +6,7 @@ in { my.system = { avahi.enable = true; + fonts.enable = true; kvm = { enable = true; cpuFlavor = "intel"; diff --git a/modules/system/default.nix b/modules/system/default.nix index 397e7ff..b5cb1a3 100644 --- a/modules/system/default.nix +++ b/modules/system/default.nix @@ -3,6 +3,7 @@ imports = [ ./avahi ./docker + ./fonts ./kvm ./podman ]; diff --git a/modules/system/fonts/default.nix b/modules/system/fonts/default.nix new file mode 100644 index 0000000..19e2d04 --- /dev/null +++ b/modules/system/fonts/default.nix @@ -0,0 +1,44 @@ +{ config, lib, pkgs, ... }: +let + cfg = config.my.system.fonts; +in +{ + options.my.system.fonts = with lib; { + enable = mkEnableOption "fonts configuration"; + + additionalFonts = mkOption { + type = types.listOf types.package; + default = [ ]; + example = "fira"; + description = "Which additional fonts should be added as well"; + }; + }; + + config = lib.mkIf cfg.enable { + fonts = { + fontconfig.defaultFonts = { + sansSerif = [ "Ubuntu" ]; + monospace = [ "Ubuntu Mono" ]; + }; + + fonts = with pkgs; [ + cantarell-fonts # gnome default + fira + fira-code # coding + fira-code-symbols # ligatures + fira-mono + font-awesome # icons + joypixels # emojis + liberation_ttf # main microsoft fonts + # mplus-outline-fonts.githubRelease # microsoft fonts + noto-fonts + noto-fonts-cjk-sans + noto-fonts-emoji + noto-fonts-extra + ubuntu_font_family + unifont # unicode fallback + ] ++ cfg.additionalFonts; + }; + nixpkgs.config.joypixels.acceptLicense = true; + }; +}