1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-08 19:46:05 +01:00
home-manager/modules/programs/gcc.nix
Austin Horstman 78fda50bd6 gcc: fix sessionVariables mkIf evaluation error
error: The option `home.sessionVariables.GCC_COLORS' was accessed but
has no value defined. Try setting the option.

Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
2025-10-05 16:22:37 -05:00

36 lines
754 B
Nix

{
config,
lib,
pkgs,
...
}:
let
cfg = config.programs.gcc;
in
{
meta.maintainers = [ lib.maintainers.bmrips ];
options.programs.gcc = {
enable = lib.mkEnableOption "{command}`gcc`.";
package = lib.mkPackageOption pkgs "gcc" { nullable = true; };
colors = lib.mkOption {
type = with lib.types; attrsOf str;
default = { };
description = "Settings for {env}`GCC_COLORS`";
example = {
error = "01;31";
};
};
};
config = lib.mkIf cfg.enable {
home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
home.sessionVariables = lib.mkIf (cfg.colors != { }) {
GCC_COLORS = lib.concatStringsSep ":" (lib.mapAttrsToList (n: v: "${n}=${v}") cfg.colors);
};
};
}