Skip to content

New API Porting Guide #283

Closed
Closed
@Pacman99

Description

@Pacman99

Hey everyone! We just did a lot of refactoring in the core branch and if you are updating to the latest changes I would recommend you read this guide on how to update.

This is a pretty quick explanation, to get more detail take a look at the doc folder which carefully goes over all the new API arguments - I also linked relevant doc sections to the headers.

The main things to notice are the changes to extern, suites and overrides.

Suites

Because of how important suites are to the configuration we decided it would be good to just define them in the flake.nix itself. You will notice a suites argument under the nixos section. You should copy all the content from your suites/default.nix to that argument.

Extern

The cool part about extern is that you can see everything a devos system depends on in one file. We believe that this information should actually be in the flake.nix too. So you can now just use different API arguments to pass external module and overlays.

Overlays

You can just put overlays in the overlays argument for the nixos channel. Where necessary, all external overlays will be automatically filtered out by inspecting your inputs.

Modules

There is a dedicated externalModules argument for this purpose.

specialArgs

We currently no longer allow passing specialArgs to host - its possible but quite difficult. The reasoning behind this was that you should add modules in the flake.nix directly instead of passing them to hosts and adding them. You can add modules to different hosts by adding lines to the hosts argument.

Overrides

Module overrides are no longer directly demonstrated by default, because of how finicky they are. It is possible by making use of the disabledModules key and the latestModulesPath special argument.

Package overrides, on the other hand, can be done in the overlays/overrides.nix file. There are plenty of examples there.


Generally as your merging, make sure to drop extern, overrides, and suites and move the code from there either to your flake.nix or the relevant files.
If you would like to split those things up into separate files, you can always just import files into the api arguments. Bonus: to de-clutter, you can leave out any import statements, where you would otherwise put them. Most items are piped through a maybeImport.

If you have any issues or comments about the API please comment here or make a dedicated issue. We would love to hear feedback!

Metadata

Metadata

Assignees

No one assigned

    Labels

    APIv1related to 1.0 api stabilization

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions