From 3746d88d79a31136293ae32d224f574258a056cd Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Tue, 23 May 2023 10:17:12 +0200 Subject: [PATCH] hercules-ci-agent: tests: Only build NixOS config for Linux --- .../hercules-ci-agent/default.nix | 64 ++++++++++--------- 1 file changed, 33 insertions(+), 31 deletions(-) diff --git a/pkgs/development/tools/continuous-integration/hercules-ci-agent/default.nix b/pkgs/development/tools/continuous-integration/hercules-ci-agent/default.nix index 205d1bf1dde5..d655941e7a27 100644 --- a/pkgs/development/tools/continuous-integration/hercules-ci-agent/default.nix +++ b/pkgs/development/tools/continuous-integration/hercules-ci-agent/default.nix @@ -35,38 +35,40 @@ in pkg.overrideAttrs (finalAttrs: o: { }; passthru = o.passthru // { - tests.help = runCommand "test-hercules-ci-agent-help" { } '' - (${finalAttrs.finalPackage}/bin/hercules-ci-agent --help 2>&1 || true) | grep -F -- '--config' - (${lib.getExe finalAttrs.finalPackage} --help 2>&1 || true) | grep -F -- '--config' - touch $out - ''; + tests = { + help = runCommand "test-hercules-ci-agent-help" { } '' + (${finalAttrs.finalPackage}/bin/hercules-ci-agent --help 2>&1 || true) | grep -F -- '--config' + (${lib.getExe finalAttrs.finalPackage} --help 2>&1 || true) | grep -F -- '--config' + touch $out + ''; + } // lib.optionalAttrs (stdenv.isLinux) { + # Does not test the package, but evaluation of the related NixOS module. + nixos-simple-config = (nixos { + boot.loader.grub.enable = false; + fileSystems."/".device = "bogus"; + services.hercules-ci-agent.enable = true; + # Dummy value for testing only. + system.stateVersion = lib.trivial.release; # TEST ONLY + }).config.system.build.toplevel; - # Does not test the package, but evaluation of the related NixOS module. - tests.nixos-simple-config = (nixos { - boot.loader.grub.enable = false; - fileSystems."/".device = "bogus"; - services.hercules-ci-agent.enable = true; - # Dummy value for testing only. - system.stateVersion = lib.trivial.release; # TEST ONLY - }).config.system.build.toplevel; - - tests.nixos-many-options-config = (nixos ({ pkgs, ... }: { - boot.loader.grub.enable = false; - fileSystems."/".device = "bogus"; - services.hercules-ci-agent = { - enable = true; - package = pkgs.hercules-ci-agent; - settings = { - workDirectory = "/var/tmp/hci"; - binaryCachesPath = "/var/keys/binary-caches.json"; - labels.foo.bar.baz = "qux"; - labels.qux = ["q" "u"]; - apiBaseUrl = "https://hci.dev.biz.example.com"; - concurrentTasks = 42; + nixos-many-options-config = (nixos ({ pkgs, ... }: { + boot.loader.grub.enable = false; + fileSystems."/".device = "bogus"; + services.hercules-ci-agent = { + enable = true; + package = pkgs.hercules-ci-agent; + settings = { + workDirectory = "/var/tmp/hci"; + binaryCachesPath = "/var/keys/binary-caches.json"; + labels.foo.bar.baz = "qux"; + labels.qux = ["q" "u"]; + apiBaseUrl = "https://hci.dev.biz.example.com"; + concurrentTasks = 42; + }; }; - }; - # Dummy value for testing only. - system.stateVersion = lib.trivial.release; # TEST ONLY - })).config.system.build.toplevel; + # Dummy value for testing only. + system.stateVersion = lib.trivial.release; # TEST ONLY + })).config.system.build.toplevel; + }; }; })