moved local to modules

This commit is contained in:
Leyla Becker 2024-11-25 00:59:05 -06:00
parent bc53ae6ee2
commit 4d191a27cc
12 changed files with 90 additions and 18 deletions

View file

@ -10,9 +10,6 @@
| `threshold` | Laptop | Eve | Laptop |
# Tooling
## Lint
`./lint.sh`
## Rebuilding
`./rebuild.sh`

View file

@ -1,18 +1,4 @@
{...}: {
# Enable networking
networking.networkmanager.enable = true;
i18n.defaultLocale = "en_US.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "en_US.UTF-8";
LC_IDENTIFICATION = "en_US.UTF-8";
LC_MEASUREMENT = "en_US.UTF-8";
LC_MONETARY = "en_US.UTF-8";
LC_NAME = "en_US.UTF-8";
LC_NUMERIC = "en_US.UTF-8";
LC_PAPER = "en_US.UTF-8";
LC_TELEPHONE = "en_US.UTF-8";
LC_TIME = "en_US.UTF-8";
};
}

View file

@ -1,5 +1,6 @@
{...}: {
imports = [
./flipperzero.nix
./i18n.nix
];
}

42
home-modules/i18n.nix Normal file
View file

@ -0,0 +1,42 @@
{
lib,
config,
...
}: {
options = {
i18n = {
defaultLocale = lib.mkOption {
type = lib.types.str;
default = "en_US.UTF-8";
example = "nl_NL.UTF-8";
description = ''
The default locale. It determines the language for program
messages, the format for dates and times, sort order, and so on.
It also determines the character set, such as UTF-8.
'';
};
extraLocaleSettings = lib.mkOption {
type = lib.types.attrsOf lib.types.str;
default = {};
example = {
LC_MESSAGES = "en_US.UTF-8";
LC_TIME = "de_DE.UTF-8";
};
description = ''
A set of additional system-wide locale settings other than
`LANG` which can be configured with
{option}`i18n.defaultLocale`.
'';
};
};
};
config = {
home.sessionVariables =
{
LANG = config.i18n.defaultLocale;
}
// config.i18n.extraLocaleSettings;
};
}

View file

@ -37,6 +37,8 @@ in {
# '';
};
keyboard.layout = "it,us";
# Home Manager can also manage your environment variables through
# 'home.sessionVariables'. If you don't want to manage your shell through Home
# Manager then you have to manually source 'hm-session-vars.sh' located at

View file

@ -4,6 +4,7 @@
...
}: {
imports = [
./i18n.nix
./packages.nix
];

12
homes/leyla/i18n.nix Normal file
View file

@ -0,0 +1,12 @@
{...}: {
i18n = {
defaultLocale = "en_IE.UTF-8";
extraLocaleSettings = {
# LC_ADDRESS = "en_IE.UTF-8"; # lets just get used to this one now
# LC_TELEPHONE = "en_IE.UTF-8"; # lets just get used to this one now
LC_MONETARY = "en_US.UTF-8"; # to be changed once I move
LC_PAPER = "en_US.UTF-8"; # convient for american printers until I move
};
};
}

View file

@ -5,6 +5,7 @@
./users.nix
./desktop.nix
./nix-development.nix
./i18n.nix
./home-manager
];
}

View file

@ -2,5 +2,6 @@
{...}: {
imports = [
./flipperzero.nix
./i18n.nix
];
}

View file

@ -0,0 +1,26 @@
{
lib,
config,
...
}: let
home-users = lib.attrsets.mapAttrsToList (_: user: user) config.home-manager.users;
in {
config = {
i18n.supportedLocales =
lib.unique
(builtins.map (l: (lib.replaceStrings ["utf8" "utf-8" "UTF8"] ["UTF-8" "UTF-8" "UTF-8"] l) + "/UTF-8") (
[
"C.UTF-8"
"en_US.UTF-8"
config.i18n.defaultLocale
]
++ (lib.attrValues (lib.filterAttrs (n: v: n != "LANGUAGE") config.i18n.extraLocaleSettings))
++ (
map (user-config: user-config.i18n.defaultLocale) home-users
)
++ (lib.lists.flatten (
map (user-config: lib.attrValues (lib.filterAttrs (n: v: n != "LANGUAGE") user-config.i18n.extraLocaleSettings)) home-users
))
));
};
}

3
host-modules/i18n.nix Normal file
View file

@ -0,0 +1,3 @@
{...}: {
i18n.defaultLocale = "en_IE.UTF-8";
}

View file

@ -53,7 +53,7 @@ in {
}: {
options = {
name = lib.mkOption {
type = lib.types.string;
type = lib.types.str;
default = name;
description = ''
What should this users name on the system be