File tree Expand file tree Collapse file tree 2 files changed +13
-4
lines changed
Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change 151151
152152 system . name = mkOption {
153153 type = types . str ;
154- default =
155- if config . networking . hostName == ""
156- then "unnamed"
157- else config . networking . hostName ;
154+ # when using full NixOS or importing the network-interfaces.nix module.
158155 defaultText = literalExpression ''
159156 if config.networking.hostName == ""
160157 then "unnamed"
182179
183180 system . build . toplevel = system ;
184181
182+ # Traditionally, the option default contained the logic for taking this from
183+ # the network.hostName option, which is expected to define it at
184+ # mkOptionDefault priority. However, we'd also like to have a default when
185+ # network.hostName is not imported.
186+ system . name = mkOverride ( ( mkOptionDefault { } ) . priority + 100 ) "unnamed" ;
187+
185188 } ;
186189
187190}
Original file line number Diff line number Diff line change @@ -1222,6 +1222,12 @@ in
12221222 }
12231223 ] ;
12241224
1225+ system . name = lib . mkOptionDefault (
1226+ if config . networking . hostName == ""
1227+ then "unnamed"
1228+ else config . networking . hostName
1229+ ) ;
1230+
12251231 boot . kernelModules = [ ]
12261232 ++ optional hasVirtuals "tun"
12271233 ++ optional hasSits "sit"
You can’t perform that action at this time.
0 commit comments