Skip to content

Instantly share code, notes, and snippets.

@yunfachi
Created August 12, 2024 17:58
Show Gist options
  • Select an option

  • Save yunfachi/44f860c799b647076773ff8bdb6e21ee to your computer and use it in GitHub Desktop.

Select an option

Save yunfachi/44f860c799b647076773ff8bdb6e21ee to your computer and use it in GitHub Desktop.
override config in Nix with evalModules
(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;
})
];
}
nix eval -f ./default.nix config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment