From 22e3a092437b4f8db417021a0af5bfd42be12ed2 Mon Sep 17 00:00:00 2001 From: Gabriel Arazas Date: Wed, 28 Feb 2024 18:47:43 +0800 Subject: [PATCH] flake-parts/setups/nixos: add `shouldbePartOfNixOSConfigurations` This allows explicitly including a NixOS config even with the unfulfilled conditions. With deploy-rs nodes, they're pretty specific so we'll opt for this solution. --- modules/flake-parts/setups/nixos.nix | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/modules/flake-parts/setups/nixos.nix b/modules/flake-parts/setups/nixos.nix index f2e9a8d7..cf75f4cd 100644 --- a/modules/flake-parts/setups/nixos.nix +++ b/modules/flake-parts/setups/nixos.nix @@ -323,6 +323,16 @@ let the NixOS configuration. ''; }; + + shouldBePartOfNixOSConfigurations = lib.mkOption { + type = lib.types.bool; + default = lib.isAttrs config.deploy || config.formats == null; + example = true; + description = '' + Indicates whether the declarative NixOS setup should be included as + part of the `nixosConfigurations` flake output. + ''; + }; }; config.modules = [ @@ -571,7 +581,7 @@ in pureNixosConfigs = let validConfigs = - lib.filterAttrs (_: v: v.formats == null || v.deploy != null) cfg.configs; + lib.filterAttrs (_: v: v.shouldBePartOfNixOSConfigurations) cfg.configs; generatePureConfigs = hostname: metadata: lib.listToAttrs