Skip to content

Commit 3b50219

Browse files
committed
lib/extensions/base/hosts: allow system option to be null
1 parent 3f8ff7c commit 3b50219

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lib/extensions/base/hosts.nix

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,19 +115,19 @@ delib.extension {
115115

116116
generateHostSystemSubmodule =
117117
_:
118-
{ config, ... }:
118+
{ config, lib, ... }:
119119
{
120-
options.system = strOption null;
120+
options.system = allowNull (strOption null);
121121

122-
config.homeManagerSystem = config.system;
122+
config.homeManagerSystem = lib.mkIf (config.system != null) config.system;
123123
};
124124
};
125125

126126
modules =
127127
extensionConfig:
128128
lib.optionals extensionConfig.hosts.enable [
129129
(
130-
{ delib, ... }:
130+
{ delib, lib, ... }:
131131
let
132132
assertionsConfig =
133133
{ myconfig, ... }:
@@ -168,6 +168,7 @@ delib.extension {
168168
lib.optionalAttrs extensionConfig.hosts.system.enable {
169169
nixpkgs.hostPlatform = lib.mkIf (
170170
delib._callLibArgs.currentHostName != null
171+
&& myconfig.hosts.${delib._callLibArgs.currentHostName}.system != null
171172
) myconfig.hosts.${delib._callLibArgs.currentHostName}.system;
172173
};
173174

@@ -176,6 +177,7 @@ delib.extension {
176177
lib.optionalAttrs extensionConfig.hosts.system.enable {
177178
nixpkgs.hostPlatform = lib.mkIf (
178179
delib._callLibArgs.currentHostName != null
180+
&& myconfig.hosts.${delib._callLibArgs.currentHostName}.system != null
179181
) myconfig.hosts.${delib._callLibArgs.currentHostName}.system;
180182
};
181183

0 commit comments

Comments
 (0)