global/locale: init, refactored from modules/locale

This commit is contained in:
Infinidoge 2024-07-26 10:49:33 -04:00
parent 1645a8a3a8
commit 421d490af1
Signed by: Infinidoge
SSH key fingerprint: SHA256:oAMyvotlNFraMmZmr+p6AxnNfW/GioTs1pOn3V4tQ7A
3 changed files with 36 additions and 51 deletions

23
modules/global/locale.nix Normal file
View file

@ -0,0 +1,23 @@
{ common, ... }:
let
cfg = common.locale;
in
{
common.locale = {
keymap = "us";
locale = "en_US.UTF-8";
timezone = "America/New_York";
};
console.keyMap = cfg.keymap;
services.xserver.xkb = {
layout = cfg.keymap;
options = "compose:ralt";
};
services.libinput.enable = true;
i18n.defaultLocale = cfg.locale;
time.timeZone = cfg.timezone;
}

View file

@ -1,39 +0,0 @@
{ config, options, lib, ... }:
with lib;
with lib.our;
let
cfg = config.modules.locale;
opt = options.modules.locale;
in
{
options.modules.locale = with types; {
keymap = mkOpt str "us";
locale = mkOpt str "en_US.UTF-8";
timezone = mkOpt (nullOr str) "America/New_York";
fonts = {
fonts = mkOpt (listOf package) [ ];
defaults = mkOpt attrs { };
};
};
config = {
console.keyMap = mkDefault cfg.keymap;
services.xserver.xkb = {
layout = mkDefault cfg.keymap;
options = "compose:ralt";
};
services.libinput.enable = true;
i18n.defaultLocale = cfg.locale;
time.timeZone = mkIf (cfg.timezone != null) cfg.timezone;
fonts = {
packages = cfg.fonts.fonts;
fontconfig.defaultFonts = mkAliasDefinitions opt.fonts.defaults;
};
console.packages = cfg.fonts.fonts;
};
}

View file

@ -84,19 +84,20 @@ in
# in # in
# (lib.mkForce "${editorScript}/bin/emacseditor"); # (lib.mkForce "${editorScript}/bin/emacseditor");
fonts.packages = with pkgs; [
(nerdfonts.override {
fonts = [ "DejaVuSansMono" "NerdFontsSymbolsOnly" ];
})
dejavu_fonts
emacs-all-the-icons-fonts
];
fonts.fontconfig.defaultFonts = {
monospace = [ "DejaVuSansMono" ];
};
modules = { modules = {
locale.fonts = {
fonts = with pkgs; [
(nerdfonts.override { fonts = config.modules.locale.fonts.defaults.monospace ++ [ "NerdFontsSymbolsOnly" ]; })
dejavu_fonts
emacs-all-the-icons-fonts
];
defaults = {
monospace = [ "DejaVuSansMono" ];
};
};
desktop.wm.qtile.enable = true; desktop.wm.qtile.enable = true;
}; };