1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-08 19:46:05 +01:00
This commit is contained in:
Eman Resu 2025-11-06 21:09:15 +00:00 committed by GitHub
commit f16ea0f360
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 144 additions and 73 deletions

View file

@ -48,6 +48,24 @@ This release has the following notable changes:
to your configuration. This option is likely to be deprecated in the
future.
- By default, Home Manager imports all modules, which leads to
increased evaluation time. Some users may wish to only import the
modules they actually use. To accomodate this, a new option
`home-manager.minimal` has been added. When this option is enabled,
Home Manager will only import the basic set of modules it requires
to function. Other modules will have to be enabled manually, like
this:
```nix
imports = [
"${modulesPath}/programs/fzf.nix"
];
```
This entrypoint is only recommended for advanced users, who are
comfortable maintaining a personal list of modules to import.
- The use of `services.syncthing.tray` as a Boolean option was removed
after being deprecated in 2021. You are now expected to use
[](#opt-services.syncthing.tray.enable) to enable the Syncthing tray

View file

@ -9,6 +9,7 @@
lib ? pkgs.lib,
modules ? [ ],
pkgs,
minimal ? false,
}:
import ../modules {
inherit
@ -16,6 +17,7 @@
extraSpecialArgs
lib
pkgs
minimal
;
configuration = {
imports = modules ++ [

View file

@ -0,0 +1,22 @@
{
time = "2025-10-11T00:06:01+00:00";
condition = true;
message = ''
A new option is availabe: `home-manager.minimal`
By default, Home Manager imports all modules, which leads to increased
evaluation time. Some users may wish to only import the modules they
actually use. When the new option is enabled, Home Manager will only
import the basic set of modules it requires to function. Other modules
will have to be enabled manually, like this:
```nix
imports = [
"''${modulesPath}/programs/fzf.nix"
];
```
This entrypoint is only recommended for advanced users, who are
comfortable maintaining a personal list of modules to import.
'';
}

View file

@ -9,11 +9,16 @@
# If disabled, the pkgs attribute passed to this function is used instead.
useNixpkgsModule ? true,
# Whether to only import the required modules, and let the user add modules
# manually
minimal ? false,
}:
let
modules = [
modules = builtins.concatLists [
[
# keep-sorted start case=no numeric=yes
./accounts/calendar.nix
./accounts/contacts.nix
@ -70,7 +75,23 @@ let
# Module deprecations and removals
./deprecations.nix
]
++ (lib.concatMap
(lib.optional useNixpkgsModule ./misc/nixpkgs.nix)
(lib.optional (!useNixpkgsModule) ./misc/nixpkgs-disabled.nix)
(
if minimal then
[
./programs/bash.nix
./programs/autojump.nix # Dependency of bash module
./programs/zsh
./programs/ion.nix
./programs/nushell.nix
./services/window-managers/i3-sway/default.nix # Dependency of home-cursor module
]
else
lib.concatMap
(
dir:
lib.pipe (builtins.readDir dir) [
@ -86,8 +107,7 @@ let
./programs
]
)
++ lib.optional useNixpkgsModule ./misc/nixpkgs.nix
++ lib.optional (!useNixpkgsModule) ./misc/nixpkgs-disabled.nix;
];
pkgsModule =
{ config, ... }:

View file

@ -42,6 +42,7 @@ let
import ../modules/modules.nix {
inherit pkgs;
lib = extendedLib;
minimal = cfg.minimal;
useNixpkgsModule = !cfg.useGlobalPkgs;
}
++ cfg.sharedModules;
@ -115,6 +116,14 @@ in
'';
};
minimal = mkEnableOption ''
only the necessary modules that allow home-manager to function. This can
be used to allow vendoring a minimal list of modules yourself, rather than
importing every single module. THIS IS FOR ADVANCED USERS, AND WILL
DISABLE ALmOST EVERY MODULE. THIS SHOULD NOT BE ENABLED UNLESS YOU KNOW
THE IMPLICATIONS.
'';
sharedModules = mkOption {
type = with types; listOf raw;
default = [ ];