From 70af808347fbfd866e04da5fe2856cb1ae75eaa4 Mon Sep 17 00:00:00 2001 From: Michael Hoang Date: Thu, 28 Sep 2023 01:49:38 +0100 Subject: linux-builder: change from `modules` to `config` Using the type `deferredModule` fixes `pkgs` not being accessible as a module argument (apart from `config._module.args.pkgs`). --- modules/nix/linux-builder.nix | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'modules') diff --git a/modules/nix/linux-builder.nix b/modules/nix/linux-builder.nix index 0d473d3..42bd2e0 100644 --- a/modules/nix/linux-builder.nix +++ b/modules/nix/linux-builder.nix @@ -8,11 +8,15 @@ let cfg = config.nix.linux-builder; builderWithOverrides = cfg.package.override { - inherit (cfg) modules; + modules = [ cfg.config ]; }; in { + imports = [ + (mkRemovedOptionModule [ "nix" "linux-builder" "modules" ] "This option has been replaced with `nix.linux-builder.config` which allows setting options directly like `nix.linux-builder.config.networking.hostName = \"banana\";.") + ]; + options.nix.linux-builder = { enable = mkEnableOption (lib.mdDoc "Linux builder"); @@ -25,21 +29,19 @@ in ''; }; - modules = mkOption { - type = types.listOf types.anything; - default = [ ]; + config = mkOption { + type = types.deferredModule; + default = { }; example = literalExpression '' - [ - ({ config, ... }: + ({ pkgs, ... }: - { - virtualisation.darwin-builder.hostPort = 22; - }) - ] + { + environment.systemPackages = [ pkgs.neovim ]; + }) ''; description = lib.mdDoc '' - This option specifies extra NixOS modules and configuration for the builder. You should first run the Linux builder - without changing this option otherwise you may not be able to build the Linux builder. + This option specifies extra NixOS configuration for the builder. You should first use the Linux builder + without changing the builder configuration otherwise you may not be able to build the Linux builder. ''; }; -- cgit v1.2.3