anchor.diff:          umount ${yubikey.storage.mountPoint}
       }
   
  -    ${optionalString (yubikey.gracePeriod > 0) ''
  -    echo -n "Waiting ${toString yubikey.gracePeriod} seconds as grace..."
  -    for i in $(seq ${toString yubikey.gracePeriod}); do
  -        sleep 1
  -        echo -n .
  -    done
  -    echo "ok"
  -    ''}
  -
  -    yubikey_missing=true
  -    ykinfo -v 1>/dev/null 2>&1
  -    if [ $? != "0" ]; then
  -        echo -n "waiting 10 seconds for yubikey to appear..."
  -        for try in $(seq 10); do
  -            sleep 1
  -            ykinfo -v 1>/dev/null 2>&1
  -            if [ $? == "0" ]; then
  -                yubikey_missing=false
  -                break
  -            fi
  -            echo -n .
  -        done
  -        echo "ok"
  +    if wait_yubikey ${toString yubikey.gracePeriod}; then
  +        open_yubikey
       else
  -        yubikey_missing=false
  -    fi
  -
  -    if [ "$yubikey_missing" == true ]; then
           echo "no yubikey found, falling back to non-yubikey open procedure"
           open_normally
  -    else
  -        open_yubikey
       fi
       ''}
   
  
positive.code: 
              echo -n "$k_luks" | hextorb | cryptsetup luksOpen ${device} ${name} ${optionalString allowDiscards "--allow-discards"} --key-file=-
  
              if [ $? == "0" ]; then
                  opened=true
                  break
              else
  
negative.code:                 };
  
                  gracePeriod = mkOption {
                    default = 10;
                    type = types.int;
                    description = "Time in seconds to wait for the Yubikey.";
                  };
  
                  ramfsMountPoint = mkOption {
  