-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Improve NixOS module #1059
Improve NixOS module #1059
Conversation
c5fbb96
to
9afabd0
Compare
Rebased. |
Pinging @rycee for review |
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.
I can't comment on the functionality of the code, but I have a few suggestions I'd like to make.
README.md
Outdated
For a more systematic documentation of Home Manager and all available | ||
options please see the [Home Manager manual][manual]. |
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.
This wording feels awkward, to me. If it needs to be changed at all, maybe something more along the lines of:
For a more systematic documentation of Home Manager and all available | |
options please see the [Home Manager manual][manual]. | |
For a more systematic overview of Home Manager and its available | |
options, please see the [Home Manager manual][manual]. |
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.
Fixed. Editing help from native speakers is highly welcome, thank you!
doc/installation.xml
Outdated
<note> | ||
<para> | ||
By default, Home Manager modules use a private <literal>pkgs</literal> instance | ||
that's configured via the <option>nixpkgs</option> options. |
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.
Pretty nitpick-y, but I hold to the belief that documentation should be more formal (and thus refrain from using contractions and other colloquialisms).
that's configured via the <option>nixpkgs</option> options. | |
that is configured via the <option>nixpkgs</option> options. |
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.
Fixed.
doc/installation.xml
Outdated
|
||
<para> | ||
To easily set Home Manager options for a specific user, use the following recipe. | ||
This is useful when a user config is composed through multiple NixOS modules. |
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.
Not necessary, but sounds better, IMHO.
This is useful when a user config is composed through multiple NixOS modules. | |
This is especially useful when a user's configuration is composed through | |
multiple NixOS modules. |
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.
Fixed.
9afabd0
to
248dbae
Compare
nixos/default.nix
Outdated
@@ -45,6 +46,11 @@ in { | |||
<option>users.users.‹name?›.packages</option> option. | |||
''; | |||
|
|||
useGlobalPkgs = mkEnableOption '' | |||
using <literal>pkgs</literal> from the NixOS modules in Home Manager. |
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.
Nothing important but perhaps
using <literal>pkgs</literal> from the NixOS modules in Home Manager. | |
using the system configuration's <literal>pkgs</literal> argument in Home Manager. |
or something would be more clear?
modules/modules.nix
Outdated
@@ -5,6 +5,9 @@ | |||
|
|||
# Whether to enable module type checking. | |||
, check ? true | |||
|
|||
# If disabled, the pkgs passed to this function are used instead |
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.
# If disabled, the pkgs passed to this function are used instead | |
# If disabled, the pkgs attribute passed to this function is used instead. |
modules/modules.nix
Outdated
_module.args.pkgs = lib.mkDefault pkgs; | ||
_module.check = check; | ||
lib = lib.hm; | ||
} // optionalAttrs (useNixpkgsModule) { |
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.
} // optionalAttrs (useNixpkgsModule) { | |
} // optionalAttrs useNixpkgsModule { |
I cherry picked the |
doc/installation.xml
Outdated
<note> | ||
<para> | ||
By default, Home Manager modules use a private <literal>pkgs</literal> instance | ||
that is configured via the <option>nixpkgs</option> options. |
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.
that is configured via the <option>nixpkgs</option> options. | |
that is configured via the <option>home-manager.users.<name?>.nixpkgs</option> options. |
doc/installation.xml
Outdated
To disable these options and to use the global <literal>pkgs</literal> from | ||
the NixOS modules, set |
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.
To disable these options and to use the global <literal>pkgs</literal> from | |
the NixOS modules, set | |
To instead use the global <literal>pkgs</literal> that is configured via | |
the <option>nixpkgs</option> options, set |
248dbae
to
45b997a
Compare
doc/installation.xml
Outdated
</para> | ||
</note> | ||
|
||
<para> |
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.
I would suggest removing this commit since it is orthogonal to the general PR and I think does not fit in the installation section. Maybe could go in a "tips and tricks" section (in a separate PR) or even on the wiki?
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.
I've removed it. Where would you add that tips and tricks section?
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.
I guess there should be a new chapter called something like "NixOS Integration", with a section "Tips and Tricks" where this would go into a subsection.
I think there you could also have more space to write text surrounding this use pattern since it is dealing with more advanced concepts such as defining your own options and using a function like mkAliasDefinitions
.
Here's a rebased version of this PR. |
Needed for the following commit.
45b997a
to
f209fbf
Compare
Thanks! Added to master in efbe138. |
The main manual page is highly relevant and should be easily discoverable from the README. PR nix-community#1059 Fixes nix-community#1048
No description provided.