test.nix (905B)
1 { 2 liminix 3 , nixpkgs 4 }: 5 let img = (import liminix { 6 device = import "${liminix}/devices/qemu/"; 7 liminix-config = "${liminix}/vanilla-configuration.nix"; 8 }).outputs.rootfs; 9 pkgs = import <nixpkgs> {}; 10 in pkgs.runCommand "check" { 11 nativeBuildInputs = with pkgs; [ squashfsTools s6-rc ] ; 12 } '' 13 destpath=$(mktemp -d)/smoke.img 14 echo $destpath 15 cleanup(){ test -n $destpath && test -d $destpath && chmod -R +w $destpath && rm -rf $destpath; } 16 trap cleanup EXIT 17 trap 'echo "command $(eval echo $BASH_COMMAND) failed with exit code $?"; exit $?' ERR 18 unsquashfs -q -d $destpath -excludes ${img} /dev 19 cd $destpath; 20 db=nix/store/*-s6-rc-database/compiled/ 21 test -d $db 22 chmod -R +w $db 23 # check we have closure of config.services (lo.link service exists only 24 # as a dependency) 25 test "$(s6-rc-db -c $db type lo.link)" = "oneshot" 26 test "$(s6-rc-db -c $db type ntp)" = "longrun" 27 echo OK > $out 28 ''