mirror of
https://github.com/nix-community/home-manager.git
synced 2026-06-05 21:02:51 +00:00
treewide: move NixOS-inherited defaults to their option definitions
This commit is contained in:
committed by
Matthieu Coudron
parent
a2c0bcaff4
commit
dd71501fb7
@@ -16,9 +16,10 @@
|
||||
# https://github.com/NixOS/nixpkgs/blob/nixpkgs-unstable/pkgs/development/libraries/glibc/nix-locale-archive.patch
|
||||
|
||||
{
|
||||
lib,
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
nixosConfig,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
@@ -55,9 +56,8 @@ in
|
||||
|
||||
This option only applies to the Linux platform.
|
||||
|
||||
When Home Manager is configured with NixOS, the default value
|
||||
will be set to {var}`i18n.glibcLocales` from the
|
||||
system configuration.
|
||||
If Home Manager is installed as a NixOS submodule, this
|
||||
option defaults to NixOS' {var}`i18n.glibcLocales`.
|
||||
'';
|
||||
example = lib.literalExpression ''
|
||||
pkgs.glibcLocales.override {
|
||||
@@ -65,9 +65,8 @@ in
|
||||
locales = [ "en_US.UTF-8/UTF-8" ];
|
||||
}
|
||||
'';
|
||||
# NB. See nixos/default.nix for NixOS default.
|
||||
default = pkgs.glibcLocales;
|
||||
defaultText = lib.literalExpression "pkgs.glibcLocales";
|
||||
default = nixosConfig.i18n.glibcLocales or pkgs.glibcLocales;
|
||||
defaultText = lib.literalExpression "nixosConfig.i18n.glibcLocales or pkgs.glibcLocales";
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
nixosConfig,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
@@ -70,7 +71,6 @@ in
|
||||
fonts.fontconfig = {
|
||||
enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Whether to enable fontconfig configuration. This will, for example,
|
||||
allow fontconfig to discover fonts and configurations installed through
|
||||
@@ -80,6 +80,17 @@ in
|
||||
{var}`home-manager.useUserPackages` is enabled, this option defaults to the
|
||||
value of NixOS' {var}`fonts.fontconfig.enable`.
|
||||
'';
|
||||
# On NixOS, the per-user directory inside /etc/profiles is not known by
|
||||
# fontconfig by default.
|
||||
default =
|
||||
nixosConfig != null
|
||||
&& nixosConfig.home-manager.useUserPackages
|
||||
&& nixosConfig.fonts.fontconfig.enable;
|
||||
defaultText = lib.literalExpression ''
|
||||
nixosConfig != null
|
||||
&& nixosConfig.home-manager.useUserPackages
|
||||
&& nixosConfig.fonts.fontconfig.enable;
|
||||
'';
|
||||
};
|
||||
|
||||
defaultFonts = {
|
||||
|
||||
@@ -68,29 +68,7 @@ in
|
||||
};
|
||||
|
||||
config = lib.mkMerge [
|
||||
{
|
||||
home-manager = {
|
||||
extraSpecialArgs.nixosConfig = config;
|
||||
|
||||
sharedModules = [
|
||||
{
|
||||
key = "home-manager#nixos-shared-module";
|
||||
|
||||
config = {
|
||||
# The per-user directory inside /etc/profiles is not known by
|
||||
# fontconfig by default.
|
||||
#
|
||||
# When changing the following line, remember to reflect these
|
||||
# changes in the description of 'fonts.fontconfig.enable'!
|
||||
fonts.fontconfig.enable = lib.mkDefault (cfg.useUserPackages && config.fonts.fontconfig.enable);
|
||||
|
||||
# Inherit glibcLocales setting from NixOS.
|
||||
i18n.glibcLocales = lib.mkDefault config.i18n.glibcLocales;
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
{ home-manager.extraSpecialArgs.nixosConfig = config; }
|
||||
|
||||
(mkIf (!cfg.startAsUserService && cfg.users != { }) {
|
||||
systemd.services = lib.mapAttrs' (
|
||||
|
||||
Reference in New Issue
Block a user