From d0121790d4aac7a7b4b6bace63c26ef53e8c7e13 Mon Sep 17 00:00:00 2001
From: Andrew Childs <lorne@cons.org.nz>
Date: Mon, 3 Oct 2022 12:33:21 +0900
Subject: [PATCH] nix: fix mandatoryFeatures in nix.buildMachines

Copied directly from https://github.com/NixOS/nixpkgs/pull/193404
---
 modules/nix/default.nix | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/modules/nix/default.nix b/modules/nix/default.nix
index 528c304a..8a5bb181 100644
--- a/modules/nix/default.nix
+++ b/modules/nix/default.nix
@@ -683,8 +683,10 @@ in
               (if machine.sshKey != null then machine.sshKey else "-")
               (toString machine.maxJobs)
               (toString machine.speedFactor)
-              (concatStringsSep "," (machine.supportedFeatures ++ machine.mandatoryFeatures))
-              (concatStringsSep "," machine.mandatoryFeatures)
+              (let res = (machine.supportedFeatures ++ machine.mandatoryFeatures);
+               in if (res == []) then "-" else (concatStringsSep "," res))
+              (let res = machine.mandatoryFeatures;
+               in if (res == []) then "-" else (concatStringsSep "," machine.mandatoryFeatures))
             ]
             ++ optional (isNixAtLeast "2.4pre") (if machine.publicHostKey != null then machine.publicHostKey else "-")))
             + "\n"