mirror of
https://github.com/LnL7/nix-darwin.git
synced 2025-04-08 18:20:48 +00:00
add tests to release.nix
This commit is contained in:
parent
337c85e1c3
commit
8a67d1d4cf
2 changed files with 51 additions and 0 deletions
41
release.nix
41
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));
|
||||
|
||||
|
|
10
tests/system-packages.nix
Normal file
10
tests/system-packages.nix
Normal file
|
@ -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"
|
||||
'';
|
||||
}
|
Loading…
Add table
Reference in a new issue