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

nix-darwin,nixos: replace {darwin,nixos}Config with osConfig #2302

Merged
merged 1 commit into from
Oct 6, 2021

Conversation

berbiche
Copy link
Member

Description

Having either argument defined based on the OS is a problem when
trying to write generic Nix code.

The current workaround is to use accept both and specify a default
value for each argument:

{ config, lib, nixosConfig ? {}, darwinConfig ? {}, ... }:

let
  osConfig = nixosConfig // darwinConfig;
in
{
  # Do something with `osConfig`
}

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.

@berbiche berbiche requested a review from rycee as a code owner August 30, 2021 03:33
@rycee
Copy link
Member

rycee commented Sep 5, 2021

Seems this would make it more difficult to have separate paths for nixos and darwin. Perhaps keep the old arguments as-is?

@berbiche
Copy link
Member Author

Seems this would make it more difficult to have separate paths for nixos and darwin. Perhaps keep the old arguments as-is?

Sure. I'll get to it soon.

Having either argument defined based on the OS is a problem when
trying to write generic Nix code.

The current workaround is to use accept both and specify a default
value for each argument:

```
{ config, lib, nixosConfig ? {}, darwinConfig ? {}, ... }:

let
  osConfig = nixosConfig // darwinConfig;
in
{
  # Do something with `osConfig`
}
```
@berbiche
Copy link
Member Author

berbiche commented Oct 6, 2021

Done, I'll merge this after the tests.

@berbiche berbiche merged commit 60ebc27 into nix-community:master Oct 6, 2021
austinharris pushed a commit to austinharris/home-manager that referenced this pull request Oct 7, 2021
Having either argument defined based on the OS is a problem when
trying to write generic Nix code.

The current workaround is to use accept both and specify a default
value for each argument:

```
{ config, lib, nixosConfig ? {}, darwinConfig ? {}, ... }:

let
  osConfig = nixosConfig // darwinConfig;
in
{
  # Do something with `osConfig`
}
```

With this commit, it becomes possible to do the following:

```
{ config, lib, osConfig, ... }:

{
  # Do something with `osConfig`
}
```
peterhoeg pushed a commit to peterhoeg/home-manager that referenced this pull request Nov 4, 2021
Having either argument defined based on the OS is a problem when
trying to write generic Nix code.

The current workaround is to use accept both and specify a default
value for each argument:

```
{ config, lib, nixosConfig ? {}, darwinConfig ? {}, ... }:

let
  osConfig = nixosConfig // darwinConfig;
in
{
  # Do something with `osConfig`
}
```

With this commit, it becomes possible to do the following:

```
{ config, lib, osConfig, ... }:

{
  # Do something with `osConfig`
}
```
@berbiche berbiche deleted the expose-os-config branch December 6, 2021 22:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants