Skip to content
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

nixos: add sharedModules and extraSpecialArgs options #1793

Merged
merged 3 commits into from
Feb 21, 2021

Conversation

Pacman99
Copy link
Contributor

@Pacman99 Pacman99 commented Feb 10, 2021

Description

closes #1698

This allows users of the nixos and nix-darwin module to set shared modules for all users and extra specialArgs to be available to home-manager modules.

The latter is named extraSpecialArgs just like the argument to modules/default.nix. This could be confusing since the the two are independent in code, but they do mean the same thing so I think the name fits.

Checklist

  • Change is backwards compatible.

  • Code formatted with ./format.

  • Code tested through nix-shell --pure tests -A run.all.

  • Test cases updated/added. See example.

  • Commit messages are formatted like

    {component}: {description}
    
    {long description}
    

    See CONTRIBUTING for more information and recent commit messages for examples.

  • If this PR adds a new module

    • Added myself as module maintainer. See example.

    • Added myself and the module files to .github/CODEOWNERS.

@Pacman99 Pacman99 requested a review from rycee as a code owner February 10, 2021 20:02
Copy link
Contributor

@thiagokokada thiagokokada left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was going to open this exactly PR, thank you.

LGTM.

@thiagokokada
Copy link
Contributor

BTW, maybe we could add something similar to nix-darwin so we can finally close issue #1698.

@Pacman99
Copy link
Contributor Author

It looks like half of this PR is already done at #1757 so I can remove my extraModules option if that one gets merged.

@Pacman99
Copy link
Contributor Author

I copied over the changes to the nix-darwin module too along with the nixosConfig specialArg.

Copy link
Contributor

@thiagokokada thiagokokada left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@thiagokokada
Copy link
Contributor

thiagokokada commented Feb 15, 2021

@rycee @berbiche Could we have this PR reviewed? It makes some use cases in HM with Flakes much easier.

I am using this PR in my backported version HM with great success (well, at least the extraSpecialArgs part, since I don't have usage for extraModules yet).

Copy link
Member

@berbiche berbiche left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution.
Few things to fix.
I'm not sure of the exact syntax of docbook used in descriptions.

nixos/default.nix Outdated Show resolved Hide resolved
nixos/default.nix Outdated Show resolved Hide resolved
nix-darwin/default.nix Outdated Show resolved Hide resolved
nix-darwin/default.nix Outdated Show resolved Hide resolved
nix-darwin/default.nix Outdated Show resolved Hide resolved
@Pacman99 Pacman99 force-pushed the more-extras branch 2 times, most recently from c222091 to 672b92b Compare February 15, 2021 04:26
@Pacman99
Copy link
Contributor Author

Pacman99 commented Feb 15, 2021

@berbiche Thanks for the review! fixed and rebased.

I am using this PR in my backported version HM with great success (well, at least the extraSpecialArgs part, since I don't have usage for extraModules yet).

I'm glad it works! I think the extraSpecialArgs is more useful for me too. I find the extra modules useful to prevent repeating code for multiple users. And I want it for nixflk, so we can automatically wire private modules.

Copy link
Member

@berbiche berbiche left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I missed a few thing earlier.

nix-darwin/default.nix Outdated Show resolved Hide resolved
nix-darwin/default.nix Outdated Show resolved Hide resolved
nixos/default.nix Outdated Show resolved Hide resolved
nixos/default.nix Outdated Show resolved Hide resolved
@Pacman99
Copy link
Contributor Author

Pacman99 commented Feb 15, 2021

Cool fixed that.
Also I squashed the commits for each file, so I added both options in one commit. Since their pretty related, and its easier to change the options. But I can split it again if thats preferred.

nix-darwin/default.nix Outdated Show resolved Hide resolved
@Pacman99 Pacman99 changed the title nixos: add extraModules and extraSpecialArgs options nixos: add sharedModules and extraSpecialArgs options Feb 18, 2021
@rycee
Copy link
Member

rycee commented Feb 18, 2021

The nix-darwin: add darwinConfig specialArg commit doesn't look correct. Maybe some squashing mistake?

Edit: Otherwise it looks fine to me, thanks for the contribution!

@berbiche berbiche merged commit 82d6ba7 into nix-community:master Feb 21, 2021
thiagokokada pushed a commit to thiagokokada/home-manager that referenced this pull request Feb 23, 2021
…munity#1793)

This allows users of the nixos and nix-darwin module to set shared modules
for all users and extra specialArgs to be available to home-manager modules.

The latter is named extraSpecialArgs just like the argument to
modules/default.nix.
This could be confusing since the the two are independent in code,
but they do mean the same thing so I think the name fits.

Darwin can now refer to the global system configuration if used as a module
through the special `darwinConfig` argument.

Co-authored-by: Nicolas Berbiche <[email protected]>
thiagokokada pushed a commit to thiagokokada/home-manager that referenced this pull request Feb 23, 2021
…munity#1793)

This allows users of the nixos and nix-darwin module to set shared modules
for all users and extra specialArgs to be available to home-manager modules.

The latter is named extraSpecialArgs just like the argument to
modules/default.nix.
This could be confusing since the the two are independent in code,
but they do mean the same thing so I think the name fits.

Darwin can now refer to the global system configuration if used as a module
through the special `darwinConfig` argument.

Co-authored-by: Nicolas Berbiche <[email protected]>
malte-v pushed a commit to malte-v/home-manager that referenced this pull request Feb 24, 2021
…munity#1793)

This allows users of the nixos and nix-darwin module to set shared modules
for all users and extra specialArgs to be available to home-manager modules.

The latter is named extraSpecialArgs just like the argument to
modules/default.nix.
This could be confusing since the the two are independent in code,
but they do mean the same thing so I think the name fits.

Darwin can now refer to the global system configuration if used as a module
through the special `darwinConfig` argument.

Co-authored-by: Nicolas Berbiche <[email protected]>
aakropotkin pushed a commit to aakropotkin/home-manager that referenced this pull request Feb 28, 2021
…munity#1793)

This allows users of the nixos and nix-darwin module to set shared modules
for all users and extra specialArgs to be available to home-manager modules.

The latter is named extraSpecialArgs just like the argument to
modules/default.nix.
This could be confusing since the the two are independent in code,
but they do mean the same thing so I think the name fits.

Darwin can now refer to the global system configuration if used as a module
through the special `darwinConfig` argument.

Co-authored-by: Nicolas Berbiche <[email protected]>
bors bot added a commit to divnix/digga that referenced this pull request Mar 23, 2021
156: Improve Home Manager support: profiles/suites, modules, extern, flake outputs r=Pacman99 a=Pacman99

A really simple method of implementing #119. 

This relies on a feature that I added in home-manager master for module options of extraSpecialArgs and sharedModules, nix-community/home-manager#1793. I could try and get that backported to 20.09. But I thought I'd get some feedback on these changes first.

Co-authored-by: Pacman99 <[email protected]>
cab404 pushed a commit to cab404/home-manager that referenced this pull request Apr 23, 2021
…munity#1793)

This allows users of the nixos and nix-darwin module to set shared modules
for all users and extra specialArgs to be available to home-manager modules.

The latter is named extraSpecialArgs just like the argument to
modules/default.nix.
This could be confusing since the the two are independent in code,
but they do mean the same thing so I think the name fits.

Darwin can now refer to the global system configuration if used as a module
through the special `darwinConfig` argument.

Co-authored-by: Nicolas Berbiche <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Accessing flakes from inside home-manager modules
4 participants