diff options
| -rw-r--r-- | release.nix | 41 | ||||
| -rw-r--r-- | tests/system-packages.nix | 10 |
2 files changed, 51 insertions, 0 deletions
diff --git a/release.nix b/release.nix index 50d114d..eb1afa2 100644 --- a/release.nix +++ b/release.nix @@ -13,6 +13,45 @@ let (import ./. { inherit nixpkgs configuration system; }).system ); + makeTest = test: + pkgs.lib.genAttrs [ "x86_64-darwin" ] (system: + let + configuration = + { config, lib, pkgs, ... }: + with lib; + { imports = [ test ]; + + options = { + out = mkOption { + type = types.package; + }; + + test = mkOption { + type = types.lines; + }; + }; + + config = { + system.build.run-test = pkgs.runCommand "run-darwin-test" + { allowSubstitutes = false; + preferLocalBuild = true; + } + '' + #! ${pkgs.stdenv.shell} + set -e + + ${config.test} + echo ok | tee $out >&2 + ''; + + out = config.system.build.toplevel; + }; + }; + system = "x86_64-darwin"; + in + (import ./. { inherit nixpkgs configuration system; }).config.system.build.run-test + ); + release = import <nixpkgs/pkgs/top-level/release-lib.nix> { inherit supportedSystems scrubJobs; packageSet = import nixpkgs; @@ -49,6 +88,8 @@ let examples.lnl = genExample ./modules/examples/lnl.nix; examples.simple = genExample ./modules/examples/simple.nix; + tests.system-packages = makeTest ./tests/system-packages.nix; + } // (mapTestOn (packagePlatforms packageSet)); diff --git a/tests/system-packages.nix b/tests/system-packages.nix new file mode 100644 index 0000000..d2cc524 --- /dev/null +++ b/tests/system-packages.nix @@ -0,0 +1,10 @@ +{ config, pkgs, ... }: + +{ + environment.systemPackages = [ pkgs.hello ]; + + test = '' + echo checking hello binary in /sw/bin >&2 + test "$(readlink -f ${config.out}/sw/bin/hello)" != "${pkgs.hello}/bin/foo" + ''; +} |
