From bd620d1855fefcba920457fdd68083c2fc995da0 Mon Sep 17 00:00:00 2001 From: Daiderd Jordan Date: Sun, 5 Nov 2017 22:55:16 +0100 Subject: [PATCH] simplify running tests with nix-build --- .travis.yml | 10 ++------- release.nix | 64 ++++++++++++++++++++++++++--------------------------- 2 files changed, 33 insertions(+), 41 deletions(-) diff --git a/.travis.yml b/.travis.yml index 77cb791e..9562a143 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,15 +5,9 @@ matrix: osx_image: xcode8.2 script: - nix-build ./release.nix -I darwin=. -A examples.simple - - nix-build ./release.nix -I darwin=. -A tests.system-packages - - nix-build ./release.nix -I darwin=. -A tests.system-path-bash - - nix-build ./release.nix -I darwin=. -A tests.system-path-fish - - nix-build ./release.nix -I darwin=. -A tests.system-path-zsh + - nix-build ./release.nix -I darwin=. -A tests - os: osx osx_image: xcode7.3 script: - nix-build ./release.nix -I darwin=. -A examples.simple - - nix-build ./release.nix -I darwin=. -A tests.system-packages - - nix-build ./release.nix -I darwin=. -A tests.system-path-bash - - nix-build ./release.nix -I darwin=. -A tests.system-path-fish - - nix-build ./release.nix -I darwin=. -A tests.system-path-zsh + - nix-build ./release.nix -I darwin=. -A tests diff --git a/release.nix b/release.nix index 8c15d8bf..c28890b1 100644 --- a/release.nix +++ b/release.nix @@ -14,44 +14,42 @@ let ); makeTest = test: - pkgs.lib.genAttrs [ "x86_64-darwin" ] (system: - let - configuration = - { config, lib, pkgs, ... }: - with lib; - { imports = [ test ]; + let + configuration = + { config, lib, pkgs, ... }: + with lib; + { imports = [ test ]; - options = { - out = mkOption { - type = types.package; - }; - - test = mkOption { - type = types.lines; - }; + options = { + out = mkOption { + type = types.package; }; - config = { - system.build.run-test = pkgs.runCommand "run-darwin-test" - { allowSubstitutes = false; - preferLocalBuild = true; - } - '' - #! ${pkgs.stdenv.shell} - set -e - - ${config.test} - echo ok >&2 - touch $out - ''; - - out = config.system.build.toplevel; + test = mkOption { + type = types.lines; }; }; - system = "x86_64-darwin"; - in - (import ./. { inherit nixpkgs configuration system; }).config.system.build.run-test - ); + + config = { + system.build.run-test = pkgs.runCommand "run-darwin-test" + { allowSubstitutes = false; + preferLocalBuild = true; + } + '' + #! ${pkgs.stdenv.shell} + set -e + + ${config.test} + echo ok >&2 + touch $out + ''; + + out = config.system.build.toplevel; + }; + }; + system = "x86_64-darwin"; + in + (import ./. { inherit nixpkgs configuration system; }).config.system.build.run-test; release = import { inherit supportedSystems scrubJobs;