From 33c55024dc5daaeac05f76724bc6095c65c13082 Mon Sep 17 00:00:00 2001 From: Johann Wagner Date: Tue, 2 Jul 2024 19:12:30 +0200 Subject: [PATCH 1/2] nixos/cloud-init: Allow systemd.network to be enabled if cloud-init.network is disabled --- nixos/modules/services/system/cloud-init.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/modules/services/system/cloud-init.nix b/nixos/modules/services/system/cloud-init.nix index 5d7258cac778..18fe1a12e3b3 100644 --- a/nixos/modules/services/system/cloud-init.nix +++ b/nixos/modules/services/system/cloud-init.nix @@ -163,7 +163,7 @@ in { text = cfg.config; } ; - systemd.network.enable = cfg.network.enable; + systemd.network.enable = mkIf cfg.network.enable true; systemd.services.cloud-init-local = { description = "Initial cloud-init job (pre-networking)"; From 49d137a9672f55340d0b505e7dcb4a268e06f241 Mon Sep 17 00:00:00 2001 From: Johann Wagner Date: Tue, 2 Jul 2024 19:19:56 +0200 Subject: [PATCH 2/2] nixos/cloud-init: Allow additional packages in cloud-init module --- nixos/modules/services/system/cloud-init.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/nixos/modules/services/system/cloud-init.nix b/nixos/modules/services/system/cloud-init.nix index 18fe1a12e3b3..7148d62b9084 100644 --- a/nixos/modules/services/system/cloud-init.nix +++ b/nixos/modules/services/system/cloud-init.nix @@ -16,6 +16,7 @@ let ++ optional cfg.btrfs.enable btrfs-progs ++ optional cfg.ext4.enable e2fsprogs ++ optional cfg.xfs.enable xfsprogs + ++ cfg.extraPackages ; hasFs = fsName: lib.any (fs: fs.fsType == fsName) (lib.attrValues config.fileSystems); settingsFormat = pkgs.formats.yaml { }; @@ -79,6 +80,14 @@ in ''; }; + extraPackages = mkOption { + type = types.listOf types.package; + default = [ ]; + description = '' + List of additional packages to be available within cloud-init jobs. + ''; + }; + settings = mkOption { description = '' Structured cloud-init configuration.