nixos-config/subprojects/wrapper-manager-fds/modules/wrapper-manager/locale.nix
Gabriel Arazas b681861b59
wrapper-manager-fds/modules: fix makeWrapper arguments
Welp, we escape the arguments properly this time since it doesn't work
anymore for some reason but at least it is consistent for both binary-
and shell-based wrappers.
2024-07-27 20:00:36 +08:00

50 lines
1.3 KiB
Nix

{ config, lib, pkgs, ... }:
let
cfg = config.locale;
localeModuleFactory = { isGlobal ? false }: {
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);
};
}