liminix

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

test.nix (965B)


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