mirror of
https://github.com/foo-dogsquared/nix-module-wrapper-manager-fds.git
synced 2025-02-07 06:19:02 +00:00
wrapper-manager-fds/modules: add locale option for global env and per-wrapper
This commit is contained in:
parent
aef2ac2825
commit
f04b1179d8
12
modules/env/home-manager/default.nix
vendored
12
modules/env/home-manager/default.nix
vendored
@ -1,4 +1,4 @@
|
||||
{ config, lib, ... }:
|
||||
{ config, lib, ... }@moduleArgs:
|
||||
|
||||
let
|
||||
cfg = config.wrapper-manager;
|
||||
@ -11,6 +11,16 @@ in
|
||||
config = lib.mkMerge [
|
||||
{ wrapper-manager.extraSpecialArgs.hmConfig = config; }
|
||||
|
||||
(lib.mkIf moduleArgs?nixosConfig {
|
||||
wrapper-manager.sharedModules = [
|
||||
({ lib, ... }: {
|
||||
# NixOS already has the option to set the locale so we don't need to
|
||||
# have this.
|
||||
config.locale.enable = lib.mkDefault false;
|
||||
})
|
||||
];
|
||||
})
|
||||
|
||||
(lib.mkIf (cfg.packages != {}) {
|
||||
home.packages =
|
||||
lib.mapAttrsToList (_: wrapper: wrapper.build.toplevel) cfg.packages;
|
||||
|
12
modules/env/nixos/default.nix
vendored
12
modules/env/nixos/default.nix
vendored
@ -9,7 +9,17 @@ in
|
||||
];
|
||||
|
||||
config = lib.mkMerge [
|
||||
{ wrapper-manager.extraSpecialArgs.nixosConfig = config; }
|
||||
{
|
||||
wrapper-manager.extraSpecialArgs.nixosConfig = config;
|
||||
|
||||
wrapper-manager.sharedModules = [
|
||||
({ lib, ... }: {
|
||||
# NixOS already has the option to set the locale so we don't need to
|
||||
# have this.
|
||||
config.locale.enable = lib.mkDefault false;
|
||||
})
|
||||
];
|
||||
}
|
||||
|
||||
(lib.mkIf (cfg.packages != {}) {
|
||||
environment.systemPackages =
|
||||
|
@ -3,6 +3,7 @@
|
||||
./base.nix
|
||||
./xdg-desktop-entries.nix
|
||||
./xdg-dirs.nix
|
||||
./locale.nix
|
||||
./build.nix
|
||||
./extra-args.nix
|
||||
];
|
||||
|
51
modules/wrapper-manager/locale.nix
Normal file
51
modules/wrapper-manager/locale.nix
Normal file
@ -0,0 +1,51 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
cfg = config.locale;
|
||||
|
||||
localeModuleFactory = { isGlobal ? false }: {
|
||||
locale = {
|
||||
enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = if isGlobal then true else cfg.enable;
|
||||
description = if isGlobal then ''
|
||||
Whether to enable explicit glibc locale support. This is recommended
|
||||
for Nix-built applications.
|
||||
'' else ''
|
||||
Whether to enable locale support for this wrapper. Recommended for
|
||||
Nix-built applications.
|
||||
'';
|
||||
};
|
||||
|
||||
package = lib.mkOption {
|
||||
type = lib.types.package;
|
||||
default =
|
||||
if isGlobal
|
||||
then (pkgs.glibcLocales.override { allLocales = true; })
|
||||
else cfg.package;
|
||||
description = ''
|
||||
The package containing glibc locales.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
options.locale = localeModuleFactory { isGlobal = true; };
|
||||
|
||||
options.wrappers =
|
||||
let
|
||||
localeSubmodule = { config, lib, name, ... }: let
|
||||
submoduleCfg = config.locale;
|
||||
in {
|
||||
options.locale = localeModuleFactory { isGlobal = false; };
|
||||
|
||||
config = lib.mkIf submoduleCfg.enable {
|
||||
env.LOCALE_ARCHIVE = "${submoduleCfg.package}/lib/locale/locale-archive";
|
||||
};
|
||||
};
|
||||
in
|
||||
lib.mkOption {
|
||||
type = with lib.types; attrsOf (submodule localeSubmodule);
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue
Block a user