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

Using overlays to change nixos module behaviour #46464

Closed
netixx opened this issue Sep 10, 2018 · 3 comments
Closed

Using overlays to change nixos module behaviour #46464

netixx opened this issue Sep 10, 2018 · 3 comments

Comments

@netixx
Copy link
Contributor

netixx commented Sep 10, 2018

Issue description

Hello,

I have been reading about overlays, and I wonder if it is possible to use them to override behaviour of one or more nixos modules. The only examples I have seen with overlays concerned packages (and not nixos modules).

Say for example, I wanted to implement this PR as an overlay because It is specific to my setup, could it be done with overlays ?

In more details, how could I change nixos/modules/tasks/network-interfaces-systemd.nix code (without having to rebase patches on top of nixpks) ? Could overlays do that ?

Thank you

@Moredread
Copy link
Contributor

I'm not sure that you can do this with overlays, but you can disable a config module and import your own variant.

In your case you could copy nixos/modules/tasks/network-interfaces-systemd.nix to your nixos directory, make your changes and add this to your config:

imports = [ ./network-interfaces-systemd.nix  ];
disabledModules = [ "tasks/network-interfaces-systemd.nix" ];

@netixx
Copy link
Contributor Author

netixx commented Sep 13, 2018

Ok thank you, I didn't know about this option !

I guess I can also use mkOverride and other related constructs to alter config properties in my config, but doing this, I need to rebuild the code in the let section of the module myself...

By the way, is there an mkSomething construct to undefine a value (say it is set by the module and I want it unset) ?

@rhendric
Copy link
Member

By the way, is there an mkSomething construct to undefine a value (say it is set by the module and I want it unset) ?

I wanted this too, so: #63553

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

No branches or pull requests

3 participants