Created
August 12, 2024 17:58
-
-
Save yunfachi/44f860c799b647076773ff8bdb6e21ee to your computer and use it in GitHub Desktop.
override config in Nix with evalModules
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (import <nixpkgs/lib>).evalModules { | |
| modules = [ | |
| ({lib, ...}: let | |
| fake_config = lib.evalModules { | |
| modules = [ | |
| ({lib, ...}: { | |
| options.fake.list = lib.mkOption {type = lib.types.listOf lib.types.str;}; | |
| config.fake.list = ["1"]; | |
| }) | |
| ]; | |
| }; | |
| in { | |
| options.list = lib.mkOption {type = lib.types.listOf lib.types.str;}; | |
| config = fake_config.config.fake; | |
| }) | |
| ]; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| nix eval -f ./default.nix config |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment