-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
modules: add minimal entrypoint to only enable core modules
#7970
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
llakala
wants to merge
1
commit into
nix-community:master
Choose a base branch
from
llakala:minimal-entrypoint
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+144
−73
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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. | ||
| ''; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,85 +9,105 @@ | |
|
|
||
| # 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 = [ | ||
| # keep-sorted start case=no numeric=yes | ||
| ./accounts/calendar.nix | ||
| ./accounts/contacts.nix | ||
| ./accounts/email.nix | ||
| ./config/home-cursor.nix | ||
| ./config/i18n.nix | ||
| ./dbus.nix | ||
| ./files.nix | ||
| ./home-environment.nix | ||
| ./i18n/input-method/default.nix | ||
| ./launchd/default.nix | ||
| ./manual.nix | ||
| ./misc/dconf.nix | ||
| ./misc/debug.nix | ||
| ./misc/editorconfig.nix | ||
| ./misc/fontconfig.nix | ||
| ./misc/gtk.nix | ||
| ./misc/lib.nix | ||
| ./misc/mozilla-messaging-hosts.nix | ||
| ./misc/news.nix | ||
| ./misc/nix-remote-build.nix | ||
| ./misc/nix.nix | ||
| ./misc/nixgl.nix | ||
| ./misc/numlock.nix | ||
| ./misc/pam.nix | ||
| ./misc/qt.nix | ||
| ./misc/qt/kconfig.nix | ||
| ./misc/shell.nix | ||
| ./misc/specialisation.nix | ||
| ./misc/submodule-support.nix | ||
| ./misc/tmpfiles.nix | ||
| ./misc/uninstall.nix | ||
| ./misc/version.nix | ||
| ./misc/vte.nix | ||
| ./misc/xdg-autostart.nix | ||
| ./misc/xdg-desktop-entries.nix | ||
| ./misc/xdg-mime-apps.nix | ||
| ./misc/xdg-mime.nix | ||
| ./misc/xdg-portal.nix | ||
| ./misc/xdg-system-dirs.nix | ||
| ./misc/xdg-terminal-exec.nix | ||
| ./misc/xdg-user-dirs.nix | ||
| ./misc/xdg.nix | ||
| ./misc/xfconf.nix | ||
| ./systemd.nix | ||
| ./targets/darwin | ||
| ./targets/generic-linux.nix | ||
| ./wayland.nix | ||
| ./xresources.nix | ||
| ./xsession.nix | ||
| # keep-sorted end | ||
| (pkgs.path + "/nixos/modules/misc/assertions.nix") | ||
| (pkgs.path + "/nixos/modules/misc/meta.nix") | ||
| # Module deprecations and removals | ||
| ./deprecations.nix | ||
| ] | ||
| ++ (lib.concatMap | ||
| ( | ||
| dir: | ||
| lib.pipe (builtins.readDir dir) [ | ||
| (lib.filterAttrs (path: _kind: !lib.hasPrefix "_" path)) | ||
| (lib.filterAttrs ( | ||
| _path: kind: kind == "directory" || (kind == "regular" && lib.hasSuffix ".nix" _path) | ||
| )) | ||
| (lib.mapAttrsToList (path: _kind: lib.path.append dir path)) | ||
| ] | ||
| ) | ||
| modules = builtins.concatLists [ | ||
| [ | ||
| ./services | ||
| ./programs | ||
| # keep-sorted start case=no numeric=yes | ||
| ./accounts/calendar.nix | ||
| ./accounts/contacts.nix | ||
| ./accounts/email.nix | ||
| ./config/home-cursor.nix | ||
| ./config/i18n.nix | ||
| ./dbus.nix | ||
| ./files.nix | ||
| ./home-environment.nix | ||
| ./i18n/input-method/default.nix | ||
| ./launchd/default.nix | ||
| ./manual.nix | ||
| ./misc/dconf.nix | ||
| ./misc/debug.nix | ||
| ./misc/editorconfig.nix | ||
| ./misc/fontconfig.nix | ||
| ./misc/gtk.nix | ||
| ./misc/lib.nix | ||
| ./misc/mozilla-messaging-hosts.nix | ||
| ./misc/news.nix | ||
| ./misc/nix-remote-build.nix | ||
| ./misc/nix.nix | ||
| ./misc/nixgl.nix | ||
| ./misc/numlock.nix | ||
| ./misc/pam.nix | ||
| ./misc/qt.nix | ||
| ./misc/qt/kconfig.nix | ||
| ./misc/shell.nix | ||
| ./misc/specialisation.nix | ||
| ./misc/submodule-support.nix | ||
| ./misc/tmpfiles.nix | ||
| ./misc/uninstall.nix | ||
| ./misc/version.nix | ||
| ./misc/vte.nix | ||
| ./misc/xdg-autostart.nix | ||
| ./misc/xdg-desktop-entries.nix | ||
| ./misc/xdg-mime-apps.nix | ||
| ./misc/xdg-mime.nix | ||
| ./misc/xdg-portal.nix | ||
| ./misc/xdg-system-dirs.nix | ||
| ./misc/xdg-terminal-exec.nix | ||
| ./misc/xdg-user-dirs.nix | ||
| ./misc/xdg.nix | ||
| ./misc/xfconf.nix | ||
| ./systemd.nix | ||
| ./targets/darwin | ||
| ./targets/generic-linux.nix | ||
| ./wayland.nix | ||
| ./xresources.nix | ||
| ./xsession.nix | ||
| # keep-sorted end | ||
| (pkgs.path + "/nixos/modules/misc/assertions.nix") | ||
| (pkgs.path + "/nixos/modules/misc/meta.nix") | ||
| # Module deprecations and removals | ||
| ./deprecations.nix | ||
| ] | ||
| ) | ||
| ++ lib.optional useNixpkgsModule ./misc/nixpkgs.nix | ||
| ++ lib.optional (!useNixpkgsModule) ./misc/nixpkgs-disabled.nix; | ||
|
|
||
| (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 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems like it should be addressed with defensive logic. We should not rely on sway being present for home-cursor logic. |
||
| ] | ||
| else | ||
| lib.concatMap | ||
| ( | ||
| dir: | ||
| lib.pipe (builtins.readDir dir) [ | ||
| (lib.filterAttrs (path: _kind: !lib.hasPrefix "_" path)) | ||
| (lib.filterAttrs ( | ||
| _path: kind: kind == "directory" || (kind == "regular" && lib.hasSuffix ".nix" _path) | ||
| )) | ||
| (lib.mapAttrsToList (path: _kind: lib.path.append dir path)) | ||
| ] | ||
| ) | ||
| [ | ||
| ./services | ||
| ./programs | ||
| ] | ||
| ) | ||
| ]; | ||
|
|
||
| pkgsModule = | ||
| { config, ... }: | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar here, we shouldn't rely on the autojump module for bash.